def _url_as_string(url):
 if isinstance(url, Request_):
  return url.get_full_url()
 elif isinstance(url, str):
  return url
 else:
  raise TypeError(('Expected type %r or %r' % (str, Request_)))

def _url_as_string ( url ) : if isinstance ( url , Request_ ) : return url . get_full_url ( ) elif isinstance ( url , str ) : return url else : raise TypeError ( ( 'Expected type %r or %r' % ( str , Request_ ) ) )
returns the url string from a url value that is either a string or urllib2 .