def toBytes(s):
  """
    Method aimed to convert a string in type bytes
    @ In, s, string,  string to be converted
    @ Out, response, bytes, the casted value
  """
  if type(s) == type(""):
    return s.encode()
  elif type(s).__name__ in ['unicode','str','bytes']:
    return bytes(s)
  else:
    return s