def uri_rewrites(rewrites=[]):
    gist_rewrites = [('^([a-f0-9]+)/?$', '/{0}'), ('^https?://gist.github.com/([^\\/]+/)?([a-f0-9]+)/?$', '/{1}')]
    if (os.environ.get('GITHUB_API_URL', '') != ''):
        gist_base_url = url_path_join(os.environ.get('GITHUB_API_URL').split('/api/v3')[0], 'gist/')
        gist_rewrites.extend([((('^' + gist_base_url) + '([^\\/]+/)?([a-f0-9]+)/?$'), '/{1}')])
    return (gist_rewrites + rewrites)
def uri_rewrites(rewrites=[]):
    gist_rewrites = [('^([a-f0-9]+)/?$', '/{0}'), ('^https?://gist.github.com/([^\\/]+/)?([a-f0-9]+)/?$', '/{1}')]
    if (os.environ.get('GITHUB_API_URL', ) != ):
        gist_base_url = url_path_join(os.environ.get('GITHUB_API_URL').split('/api/v3')[0], 'gist/')
        gist_rewrites.extend([((('^' + gist_base_url) + '([^\\/]+/)?([a-f0-9]+)/?$'), '/{1}')])
    return (gist_rewrites + rewrites)