To solve this optimization problem, we first need to define the decision variables, the objective function, and the constraints.

Let's denote:
- \(T\) as the number of tennis rackets produced.
- \(B\) as the number of badminton rackets produced.

The objective is to maximize profit. The profit per tennis racket is $20, and the profit per badminton racket is $17. Therefore, the total profit \(P\) can be represented as:
\[ P = 20T + 17B \]

There are two constraints based on the time available for molding and stringing:
1. Molding constraint: Each tennis racket takes 12 minutes to mold, and each badminton racket takes 10 minutes to mold. There are 3000 minutes available for molding.
\[ 12T + 10B \leq 3000 \]
2. Stringing constraint: Each tennis racket takes 15 minutes to string, and each badminton racket takes 12 minutes to string. There are 3500 minutes available for stringing.
\[ 15T + 12B \leq 3500 \]

Additionally, \(T\) and \(B\) must be non-negative since they represent the number of rackets.

Now, let's translate this problem into Gurobi code in Python:

```python
from gurobipy import *

# Create a new model
m = Model("Racket_Production")

# Define the decision variables
T = m.addVar(lb=0, vtype=GRB.INTEGER, name="Tennis_Rackets")
B = m.addVar(lb=0, vtype=GRB.INTEGER, name="Badminton_Rackets")

# Set the objective function: Maximize profit
m.setObjective(20*T + 17*B, GRB.MAXIMIZE)

# Add constraints
m.addConstr(12*T + 10*B <= 3000, name="Molding_Constraint")
m.addConstr(15*T + 12*B <= 3500, name="Stringing_Constraint")

# Optimize the model
m.optimize()

# Print the results
if m.status == GRB.OPTIMAL:
    print(f"Optimal solution found: Produce {T.x} tennis rackets and {B.x} badminton rackets.")
    print(f"Maximum profit: ${20*T.x + 17*B.x}")
else:
    print("No optimal solution found. The model is either infeasible or unbounded.")

```
```python
from gurobipy import *

# Create a new model
m = Model("Racket_Production")

# Define the decision variables
T = m.addVar(lb=0, vtype=GRB.INTEGER, name="Tennis_Rackets")
B = m.addVar(lb=0, vtype=GRB.INTEGER, name="Badminton_Rackets")

# Set the objective function: Maximize profit
m.setObjective(20*T + 17*B, GRB.MAXIMIZE)

# Add constraints
m.addConstr(12*T + 10*B <= 3000, name="Molding_Constraint")
m.addConstr(15*T + 12*B <= 3500, name="Stringing_Constraint")

# Optimize the model
m.optimize()

# Print the results
if m.status == GRB.OPTIMAL:
    print(f"Optimal solution found: Produce {T.x} tennis rackets and {B.x} badminton rackets.")
    print(f"Maximum profit: ${20*T.x + 17*B.x}")
else:
    print("No optimal solution found. The model is either infeasible or unbounded.")

```