def METHOD_NAME(scr_env, nodelist):
  # if SCR_MIN_NODES is set, use that
  num_needed = os.environ.get('SCR_MIN_NODES')
  if num_needed is None or int(num_needed) <= 0:
    # otherwise, use value in nodes file if one exists
    num_needed = scr_env.get_runnode_count()
    if num_needed <= 0:
      # otherwise, assume we need all nodes in the allocation
      num_needed = scr_glob_hosts(count=True,
                                  hosts=nodelist,
                                  resmgr=scr_env.resmgr)
      if num_needed is None:
        # failed all methods to estimate the minimum number of nodes
        return 0
  return int(num_needed)