def _parse_hstore(hstore_str):
    result = {}
    pos = 0
    pair_match = HSTORE_PAIR_RE.match(hstore_str)

    while pair_match is not None:
        key = pair_match.group('key').replace(r'\"', '"').replace(
            "\\\\", "\\")
        if pair_match.group('value_null'):
            value = None
        else:
            value = pair_match.group('value').replace(
                r'\"', '"').replace("\\\\", "\\")
        result[key] = value

        pos += pair_match.end()

        delim_match = HSTORE_DELIMITER_RE.match(hstore_str[pos:])
        if delim_match is not None:
            pos += delim_match.end()

        pair_match = HSTORE_PAIR_RE.match(hstore_str[pos:])

    if pos != len(hstore_str):
        raise ValueError(_parse_error(hstore_str, pos))

    return result
Parse an hstore from its literal string representation.
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/hstore.py/_parse_hstore