def to_python(self, value):
        # object case
        if value is None:
            return None
        if isinstance(value, dict):
            return value

        # string case
        if value and value[0] in '[{':
            # JSON
            try:
                d = json.loads(value)
            except __HOLE__:
                d = None
        else:
            # phpserialize data
            try:
                if isinstance(value, unicode):
                    value = value.encode('utf8')
                d = php.unserialize(value, decode_strings=True)
            except ValueError:
                d = None
        if isinstance(d, dict):
            return d
        return None
dataset/ETHPy150Open mozilla/addons-server/src/olympia/stats/db.py/StatsDictField.to_python