<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def nf_step_to_process(step, out_handle):
 """Convert CWL step into a nextflow process. """

    pprint.pprint(step)

    directives = []
    for req in step["task_definition"]["requirements"]:
        if req["requirement_type"] == "docker":
            directives.append("container '%s'" % req["value"])
        elif req["requirement_type"] == "cpu":
            directives.append("cpus %s" % req["value"])
        elif req["requirement_type"] == "memory":
            directives.append("memory '%s'" % req["value"])

    task_id = step["task_id"]
    directives = "\n  ".join(directives)
    inputs = "\n    ".join(nf_io_to_process(step["inputs"], step["task_definition"]["inputs"],
                                        step["scatter"]))
    outputs = "\n    ".join(nf_io_to_process(step["outputs"], step["task_definition"]["outputs"]))
    commandline = (step["task_definition"]["baseCommand"] + " " +
                   " ".join([nf_input_to_cl(i) for i in step["task_definition"]["inputs"]]))
    out_handle.write(_nf_process_tmpl.format(**locals()))