Load JSON or YAML depending on the file extension. Returns a dict

def loads_json_or_yaml(file_path, content):
    """ Load JSON or YAML depending on the file extension. Returns a dict """
    if os.path.splitext(file_path)[1] == ".json":
        return json.loads(content)
    else:
        return inginious.common.custom_yaml.load(content)