def METHOD_NAME(mod_dict):
  """
  Test if the objects in Oil can be pickled.
  """
  #print(sys.modules)
  #d = dict(sys.modules)  # prevent copies
  # vars that aren't not classes or functions, which are presumed to be
  # constant
  global_vars = []
  classes = []  # user-defined classes
  funcs = []  # functions
  seen_ids = set()  # id
  num_objects = 0
  num_modules = 0
  n = 0
  for mod_name, mod in mod_dict.iteritems():
    if mod is pickle:
      continue
    if mod is copy_reg:
      continue
    if mod is unpickle:
      continue
    if mod is sys:  # get rid of it
      continue
    if mod is types:  # lots of stuff here no
      continue
    names = dir(mod)
    log('mod %s', mod)
    for name in names:
      if not name.startswith('__'):
        obj = getattr(mod, name)
        id_ = id(obj)
        if id_ in seen_ids:
          continue
        seen_ids.add(id_)
        log('%r = %r', name, obj)
        if isinstance(obj, types.ModuleType):  # e.g. ASDL modules
          continue
        if isinstance(obj, types.FileType):  # types_asdl.pickle is opened
          continue
        if name == 'Struct':  # struct module
          continue
        if name in ('InputType', 'OutputType', 'cStringIO_CAPI'):  # cStringIO
          continue
        if name in ('_pattern_type',):  # re
          continue
        if obj is __builtin__.Ellipsis:
          continue
        if obj is __builtin__.NotImplemented:
          continue
        if obj is types.BuiltinFunctionType:
          continue
        if obj is types.ClassType:
          continue
        if obj is mod_dict:  # circular!
          continue
        s = pickle.dumps(obj)
        # NOTE: this could be inefficient because it's a graph, not a tree.
        n += len(s)
        log('%d bytes', n)
        num_objects += 1
        if name == 'print_function':
          continue
        # sys.modules gets polluted because of pickle, etc.
        # get rid of _sre, _warnings, etc.
        # still might want _struct
        if (mod_name.startswith('_') and not mod_name.startswith('_devbuild')
            or mod_name in ('codecs', 'encodings', 'encodings.aliases', 're',
              'sre_constants', 'sre_compile', 'sre_parse')):
          continue
        # user-defined types, not types.ClassType which is old-style 
        # builtin functions can't be compiled.
        #types_to_compile = (types.FunctionType, types.BuiltinFunctionType, type)
        if isinstance(obj, types.BuiltinFunctionType):
          continue  # cannot be compiled, not a constant
        if isinstance(obj, types.FunctionType):
          funcs.append((mod_name, name, obj))
          continue
        if isinstance(obj, type):
          classes.append((mod_name, name, obj))
          continue
        global_vars.append((mod_name, name, obj))
    num_modules += 1
  log('Pickled %d objects in %d modules', num_objects, num_modules)
  log('')
  if 0:
    var_type_hist = PrintVars(global_vars)
    log('')
  num_methods, attr_type_hist = PrintClasses(classes)
  log('')
  if 0:
    PrintFuncs(funcs)
    log('')
  if 0:
    log('Global variable types:')
    for type_str, count in var_type_hist.most_common():
      log('%10d %s', count, type_str)
    log('')
  log('Class attribute types:')
  for type_str, count in attr_type_hist.most_common():
    log('%10d %s', count, type_str)
  log('')
  # Audit what's at the top level.  int, dict, str, list are most common, then
  # FlagSpec.
  log('%d global vars', len(global_vars))
  log('%d user-defined classes, with %d total methods on them', len(classes),
      num_methods)
  log('%d user-defined functions', len(funcs))