<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def relation_factory(relation_name):
 """Get the RelationFactory for the given relation name. Looks for a RelationFactory in the first file matching: ``$CHARM_DIR/hooks/relations/{interface}/{provides,requires,peer}.py`` """

    role, interface = hookenv.relation_to_role_and_interface(relation_name)
    if not (role and interface):
        hookenv.log('Unable to determine role and interface for relation '
                    '{}'.format(relation_name), hookenv.ERROR)
        return None
    return _find_relation_factory(_relation_module(role, interface))