code: def boolean(text):
      
  
      tmp = text.lower()
      if tmp.isdigit():
          return bool(int(tmp))
      elif tmp in ('t', 'true', 'on', 'yes'):
          return True
      elif tmp in ('f', 'false', 'off', 'no'):
          return False
  
      raise ValueError("invalid Boolean value %r" % text)
docs: An alternative to the "bool" argument type which interprets string
      values.