Generate JSON or YAML depending on the file extension.

def get_json_or_yaml(file_path, content):
    """ Generate JSON or YAML depending on the file extension. """
    if os.path.splitext(file_path)[1] == ".json":
        return json.dumps(content, sort_keys=False, indent=4, separators=(',', ': '))
    else:
        return inginious.common.custom_yaml.dump(content)