import json


def _record_value_parser(buf):
    """
    Parses value within OVSDB tables and returns python object corresponding
    to the value type.

    :param buf: value of 'ovs-vsctl list' or `ovs-vsctl find` command.
    :return: python object corresponding to the value type of row.
    """
    if buf.startswith('["uuid",'):
        # UUID type
        # e.g.)
        #   ["uuid","79c26f92-86f9-485f-945d-5786c8147f53"]
        _, value = json.loads(buf)
    elif buf.startswith('["set",'):
        # Set type
        # e.g.)
        #   ["set",[100,200]]
        _, value = json.loads(buf)
    elif buf.startswith('["map",'):
        # Map type
        # e.g.)
        #   ["map",[["stp-enable","true"]]]
        _, value = json.loads(buf)
        value = dict(value)
    else:
        # Other type
        # e.g.)
        #   "br1"       --> str
        #   100         --> int
        #   true/false  --> True/False
        #   null  ...   --> None
        value = json.loads(buf)

    return value