code: def condition2checker(condition):
      
      if isinstance(condition, string_types):
          def smatcher(info):
              return fnmatch.fnmatch(info.filename, condition)
  
          return smatcher
      elif isinstance(condition, (list, tuple)) and isinstance(condition[0],
                                                               integer_types):
          def imatcher(info):
              return info.index in condition
  
          return imatcher
      elif callable(condition):
          return condition
      else:
          raise TypeError
docs: Converts different condition types to callback