def absolute_location(url, location):
 if ('://' in location):
  return location
 elif location.startswith('/'):
  parts = six.moves.urllib.parse.urlsplit(url)
  base = url.replace(parts[2], '')
  return ('%s%s' % (base, location))
 elif (not location.startswith('/')):
  base = os.path.dirname(url)
  return ('%s/%s' % (base, location))
 else:
  return location

def absolute_location ( url , location ) : if ( '://' in location ) : return location elif location . startswith ( '/' ) : parts = six . moves . urllib . parse . urlsplit ( url ) base = url . replace ( parts [ 2 ] , '' ) return ( '%s%s' % ( base , location ) ) elif ( not location . startswith ( '/' ) ) : base = os . path . dirname ( url ) return ( '%s/%s' % ( base , location ) ) else : return location
attempts to create an absolute url based on initial url .