def create_pre_execute(task_params, parameter_map):
    """
    Builds the code block for the GPTool Execute method before the job is
    submitted based on the input task_params.

    :param task_params: A list of task parameters from the task info structure.
    :return: A string representing the code block to the GPTool Execute method.
    """
    gp_params = [_PRE_EXECUTE_INIT_TEMPLATE]
    for task_param in task_params:
        if task_param['direction'].upper() == 'OUTPUT':
            continue

        # Convert DataType
        data_type = task_param['type'].upper()
        if 'dimensions' in task_param:
            data_type += 'ARRAY'

        if data_type in parameter_map:
            gp_params.append(parameter_map[data_type].pre_execute().substitute(task_param))

    gp_params.append(_PRE_EXECUTE_CLEANUP_TEMPLATE)
    return ''.join(gp_params)
Builds the code block for the GPTool Execute method before the job is
    submitted based on the input task_params.

    :param task_params: A list of task parameters from the task info structure.
    :return: A string representing the code block to the GPTool Execute method.