import pickle
import base64


def str2obj(textstr):
    """Parse object from base64 encoded string.

    Usage::

        >>> from weatherlab.lib.dataIO.pk import str2obj
        >>> str2obj("gAJ9cQAoWAEAAABhcQFLAVgBAAAAYnECSwJ1Lg==")
        {"a": 1, "b": 2}

    **中文文档**

    从"字符串"中恢复Python对象
    """
    return pickle.loads(base64.b64decode(textstr.encode("utf-8")))