To solve this optimization problem, we first need to define the decision variables and the objective function. Let's denote the number of soccer balls produced as \(x\) and the number of basketballs produced as \(y\).

The profit per soccer ball is $5, and the profit per basketball is $8. Therefore, the total profit can be represented by the objective function:
\[ \text{Maximize:} \quad 5x + 8y \]

Now, let's consider the constraints:

1. **Sewing Time Constraint:** Each soccer ball requires 20 minutes of sewing, and each basketball requires 15 minutes of sewing. The total available sewing time is 5000 minutes. This can be represented as:
\[ 20x + 15y \leq 5000 \]

2. **Quality Checking Time Constraint:** Each soccer ball requires 10 minutes of quality checking, and each basketball requires 12 minutes of quality checking. The total available quality checking time is 4500 minutes. This constraint can be represented as:
\[ 10x + 12y \leq 4500 \]

3. **Non-Negativity Constraints:** Since the number of soccer balls and basketballs cannot be negative, we have:
\[ x \geq 0 \]
\[ y \geq 0 \]

Given these constraints and the objective function, we can now write the Gurobi code in Python to solve this linear programming problem.

```python
from gurobipy import *

# Create a model
m = Model("Production_Optimization")

# Define decision variables
x = m.addVar(name="soccer_balls", vtype=GRB.CONTINUOUS, lb=0)
y = m.addVar(name="basketballs", vtype=GRB.CONTINUOUS, lb=0)

# Objective function: Maximize profit
m.setObjective(5*x + 8*y, GRB.MAXIMIZE)

# Constraints
m.addConstr(20*x + 15*y <= 5000, name="sewing_time")
m.addConstr(10*x + 12*y <= 4500, name="quality_checking")

# Optimize model
m.optimize()

# Print results
if m.status == GRB.OPTIMAL:
    print(f"Optimal solution found: Produce {x.x:.2f} soccer balls and {y.x:.2f} basketballs.")
else:
    print("No optimal solution found. The problem might be infeasible.")

```