## Step 1: Define the symbolic variables
Let's define the symbolic variables as follows:
- $x_1$ represents the number of regular keyboards
- $x_2$ represents the number of mechanical keyboards

## Step 2: Translate the objective function into symbolic notation
The factory makes a profit of $30 per regular keyboard and $60 per mechanical keyboard. The objective function to maximize profit is:
\[ \text{Maximize:} \quad 30x_1 + 60x_2 \]

## 3: Translate the constraints into symbolic notation
The constraints based on the problem description are:
1. Demand for regular keyboards: $x_1 \geq 165$
2. Demand for mechanical keyboards: $x_2 \geq 70$
3. Production limits for regular keyboards: $x_1 \leq 300$
4. Production limits for mechanical keyboards: $x_2 \leq 150$
5. Contract requirement for total keyboards: $x_1 + x_2 \geq 250$

## 4: Compile the symbolic representation
The symbolic representation of the problem is:
```json
{
    'sym_variables': [('x1', 'regular keyboards'), ('x2', 'mechanical keyboards')],
    'objective_function': '30*x1 + 60*x2',
    'constraints': [
        'x1 >= 165',
        'x2 >= 70',
        'x1 <= 300',
        'x2 <= 150',
        'x1 + x2 >= 250'
    ]
}
```

## 5: Write the Gurobi code in Python
Now, let's write the Gurobi code to solve this linear programming problem:
```python
import gurobi

def solve_keyboard_factory_problem():
    # Create a new model
    model = gurobi.Model()

    # Define the variables
    x1 = model.addVar(lb=0, name="regular_keyboards", vtype=gurobi.GRB.CONTINUOUS)
    x2 = model.addVar(lb=0, name="mechanical_keyboards", vtype=gurobi.GRB.CONTINUOUS)

    # Objective function: Maximize 30*x1 + 60*x2
    model.setObjective(30*x1 + 60*x2, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(x1 >= 165, name="demand_regular")
    model.addConstr(x2 >= 70, name="demand_mechanical")
    model.addConstr(x1 <= 300, name="production_limit_regular")
    model.addConstr(x2 <= 150, name="production_limit_mechanical")
    model.addConstr(x1 + x2 >= 250, name="contract_requirement")

    # Update the model
    model.update()

    # Solve the model
    model.optimize()

    # Print the solution
    if model.status == gurobi.GRB.OPTIMAL:
        print("Optimal solution found.")
        print(f"Regular keyboards: {x1.varValue}")
        print(f"Mechanical keyboards: {x2.varValue}")
        print(f"Max Profit: {model.objVal}")
    else:
        print("No optimal solution found.")

solve_keyboard_factory_problem()
```