code: def pydeps2reqs(deps):
      
      reqs = defaultdict(set)
      for k, v in list(deps.items()):
          # not a built-in
          p = v['path']
          if p and not p.startswith(sys.real_prefix):
              if p.startswith(sys.prefix) and 'site-packages' in p:
                  if not p.endswith('.pyd'):
                      if '/win32/' in p.replace('\\', '/'):
                          reqs['win32'] |= set(v['imported_by'])
                      else:
                          name = k.split('.', 1)[0]
                          if name not in skiplist:
                              reqs[name] |= set(v['imported_by'])
  
      if '_dummy' in reqs:
          del reqs['_dummy']
      return '\n'.join(dep2req(name, reqs[name]) for name in sorted(reqs))
docs: Convert a deps instance into requirements.