import requests


def get_data(name=None, url=None):
    """
    Get data about a series from TVMaze.

    If the status is not OK or the content is empty, an assertion takse care of
    that.

    :param name: a string, the name of a show
    :pram url: a string, the url from the TVMaze API
    :return: a dict, parsed from a JSON
    """
    if name:
        data = requests.get(
            'http://api.tvmaze.com/singlesearch/shows?q={}'.format(name)
        )
    elif url:
        data = requests.get(url)
    else:
        raise TypeError("No input given. Give a name of a show or a URL.")
    assert data.status_code == 200, "Problems with the query or connection."
    assert data, "No results. Try to refine your query."
    return data.json()