def as_str(obj, encoding=convert.LOCALE, pretty=False):
    """
    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
    """

    return as_unicode(obj, encoding, pretty).encode(encoding)
def as_str ( obj , encoding = convert . LOCALE , pretty = False ) : return as_unicode ( obj , encoding , pretty ) . encode ( encoding )
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