code: def get_needs():
      # This function modifies the contents of the global `outneeds` dict.
      res = {}
      for n in outneeds.keys():
          out = []
          saveout = copy.copy(outneeds[n])
          while len(outneeds[n]) > 0:
              if outneeds[n][0] not in needs:
                  out.append(outneeds[n][0])
                  del outneeds[n][0]
              else:
                  flag = 0
                  for k in outneeds[n][1:]:
                      if k in needs[outneeds[n][0]]:
                          flag = 1
                          break
                  if flag:
                      outneeds[n] = outneeds[n][1:] + [outneeds[n][0]]
                  else:
                      out.append(outneeds[n][0])
                      del outneeds[n][0]
              if (
                  saveout
                  and (
                      0
                      not in map(
                          lambda x, y: x == y, saveout, outneeds[n]
                      )
                  )
                  and outneeds[n] != []
              ):
                  print(n, saveout)
                  errmess(
                      "get_needs: no progress in sorting needs, probably circular dependence, skipping.\n"
                  )
                  out = out + saveout
                  break
              saveout = copy.copy(outneeds[n])
          if out == []:
              out = [n]
          res[n] = out
      return res
  
imports: import sys
  import copy
  from .None import __version__
label_desc: Use image node_id 3 for calling a global function with example usage: get_needs() and returns: res