def METHOD_NAME(file_path, metadata):
    """ Writes metadata to a XML file in directory. """
    xml = dict_to_XML('metadata', metadata)
    xml_doc = parseString(tostring(xml).decode('UTF-8'))
    with open(file_path, 'w') as f:
        f.write(xml_doc.toprettyxml())