code: def basestring_to_message(text):
      
      if isinstance(text, Message):
          return text
      elif text is None:
          return ''
      else:
          report = m.Message()
          report.add(text)
          return report
docs: Convert a basestring to a Message object if needed.
  
      Avoid using this function, better to create the Message object yourself.
      This one is very generic.
  
      This function exists ust in case we get a basestring and we really need a
      Message object.
  
      :param text: The text.
      :type text: basestring, Message
  
      :return: The message object.
      :rtype: message