Fetch a gist and return the contents as a string.

def fetch_git(repo, filename, branch="master", hash=None):
    """Fetch a gist and return the contents as a string."""
    url = git_url(repo, filename, branch, hash)
    response = requests.get(url)

    if response.status_code != 200:
        raise Exception('Got a bad status looking up gist.')
    body = response.text
    if not body:
        raise Exception('Unable to get the gist contents.')

    return body