code: def construct(parts):
      
      url = ''
      if parts.scheme:
          if parts.scheme in SCHEMES:
              url += parts.scheme + '://'
          else:
              url += parts.scheme + ':'
      if parts.username and parts.password:
          url += parts.username + ':' + parts.password + '@'
      elif parts.username:
          url += parts.username + '@'
      if parts.subdomain:
          url += parts.subdomain + '.'
      url += parts.domain
      if parts.tld:
          url += '.' + parts.tld
      if parts.port:
          url += ':' + parts.port
      if parts.path:
          url += parts.path
      if parts.query:
          url += '?' + parts.query
      if parts.fragment:
          url += '#' + parts.fragment
      return url
docs: Construct a new URL from parts.