'Returns the base url for the given host and version'

def base_url(self, version):

    host = self.request.headers.get('host', 'nohost')
    if ('admin/api' in self.request.path):
        return ((((self.request.scheme + '://') + host) + '/admin/api/') + version)
    else:
        return ((((self.request.scheme + '://') + host) + '/api/') + version)
