code: def normalize_jr(jr, url=None):
      
  
      if jr == None:
          return jr
  
      idx = jr.find('#')
      path, jp = (jr[:idx], jr[idx+1:]) if idx != -1 else (jr, None)
  
      if len(path) > 0:
          p = six.moves.urllib.parse.urlparse(path)
          if p.scheme == '' and url:
              p = six.moves.urllib.parse.urlparse(url)
              # it's the path of relative file
              path = six.moves.urllib.parse.urlunparse(p[:2]+('/'.join([os.path.dirname(p.path), path]),)+p[3:])
              path = derelativise_url(path)
      else:
          path = url
  
      if path:
          return ''.join([path, '#', jp]) if jp else path
      else:
          return '#' + jp
docs: normalize JSON reference, also fix
      implicit reference of JSON pointer.
      input:
      - #/definitions/User
      - http://test.com/swagger.json#/definitions/User
      output:
      - http://test.com/swagger.json#/definitions/User
  
      input:
      - some_folder/User.json
      output:
      - http://test.com/some_folder/User.json