code: def derelativise_url(url):
      '''
      Normalizes URLs, gets rid of .. and .
      '''
      parsed = six.moves.urllib.parse.urlparse(url)
      newpath=[]
      for chunk in parsed.path[1:].split('/'):
          if chunk == '.':
              continue
          elif chunk == '..':
              # parent dir.
              newpath=newpath[:-1]
              continue
          # TODO: Verify this behaviour.
          elif _fullmatch(r'\.{3,}', chunk) is not None:
              # parent dir.
              newpath=newpath[:-1]
              continue
          newpath += [chunk]
      return six.moves.urllib.parse.urlunparse(parsed[:2]+('/'+('/'.join(newpath)),)+parsed[3:]f derelativise_url(url):
      '''
      Normalizes URLs, gets rid of .. and .
      '''
      parsed = six.moves.urllib.parse.urlparse(url)
      newpath=[]
      for chunk in parsed.path[1:].split('/'):
          if chunk == '.':
              continue
          elif chunk == '..':
              # parent dir.
              newpath=newpath[:-1]
              continue
          # TODO: Verify this behaviour.
          elif _fullmatch(r'\.{3,}', chunk) is not None:
              # parent dir.
              newpath=newpath[:-1]
              continue
          newpath += [chunk]
      return six.moves.urllib.parse.urlunparse(parsed[:2]+('/'+('/'.join(newpath)),)+parsed[3:])
docs: Normalizes URLs, gets rid of .. and .