def METHOD_NAME(experiment):
    search_space = HyperParameterSearchSpace()
    if experiment.spec.objective.type == api.MAXIMIZE:
        search_space.goal = constant.MAX_GOAL
    elif experiment.spec.objective.type == api.MINIMIZE:
        search_space.goal = constant.MIN_GOAL
    for p in experiment.spec.parameter_specs.parameters:
        search_space.params.append(
            HyperParameterSearchSpace.convert_parameter(p))
    return search_space