code: def load_dependencies(req, history=None):
      
      if history is None:
          history = set()
      dist = pkg_resources.get_distribution(req)
      spec = dict(
          requirement=str(req),
          resolved=str(dist),
      )
      if req not in history:
          # traverse into children
          history.add(req)
          extras = parse_extras(req)
          depends = [
              load_dependencies(dep, history=history)
              for dep in dist.requires(extras=extras)
          ]
          if depends:
              spec.update(depends=depends)
      return spec
docs: Load the dependency tree as a Python object tree,
      suitable for JSON serialization.
  
      >>> deps = load_dependencies('jaraco.packaging')
      >>> import json
      >>> doc = json.dumps(deps)