code: def bool_from_string(value):
      
      if isinstance(value, six.string_types):
          value = six.text_type(value)
      else:
          msg = "Unable to interpret non-string value '%s' as boolean" % (value)
          raise ValueError(msg)
  
      value = value.strip().lower()
  
      if value in ['y', 'yes', 'true', 't', 'on']:
          return True
      elif value in ['n', 'no', 'false', 'f', 'off']:
          return False
  
      msg = "Unable to interpret string value '%s' as boolean" % (value)
      raise ValueError(msg)
docs: Interpret string value as boolean.
  
      Returns True if value translates to True otherwise False.