<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_mmcif(code, outfile=None):
 """ Get mmcif file associated with code from PDBE. Parameters code : str PDB code. outfile : str Filepath. Writes returned value to this file. Returns ------- mmcif_file : str Filepath to the mmcif file. """

    pdbe_url = "http://www.ebi.ac.uk/pdbe/entry-files/download/{0}.cif".format(code)
    r = requests.get(pdbe_url)
    if r.status_code == 200:
        mmcif_string = r.text
    else:
        print("Could not download mmcif file for {0}".format(code))
        mmcif_string = None

    # Write to file.
    if outfile and mmcif_string:
        with open(outfile, 'w') as foo:
            foo.write(mmcif_string)

    return mmcif_string