import json
import requests


def get_schema(post_args):
    """Returns schema in Python format, if provided as uploaded file or URL"""

    if post_args['schema']:
        schema_file = post_args['schema'].stream
        return json.load(schema_file)
    elif post_args['schema_url']:
        resp = requests.get(post_args['schema_url'])
        return resp.json()