docs: def parse_location(loc, default_port):
      '''
      loc can be of the format http://<ip/domain>[:<port>]
      eg:
          http://localhost:8888
          http://localhost/
      return ip (str), port (int)
      >>> parse_location('http://localhost/', 6379)
      ('localhost', 6379)
      >>> parse_location('http://localhost:8888', 6379)
      ('localhost', 8888)
      '''
  
      parsed = urlparse(loc)
  
      if ':' in parsed.netloc:
          ip, port = parsed.netloc.split(':')
          port = int(port)
      else:
          ip, port = parsed.netloc, default_port
  
      return ip, port