code: def as_str(obj, encoding=convert.LOCALE, pretty=False):
      
  
      return as_unicode(obj, encoding, pretty).encode(encoding)
docs: Representing any object to <str> string (python2.7) or <bytes> string (python3.0).
  
      :param obj: any object
      :type encoding: str
      :param encoding: codec for encoding unicode strings
                       (locale.getpreferredencoding() by default)
      :type pretty: bool
      :param pretty: pretty print
  
      :rtype: str
      :return: any object as string