import re


def parse_tuple(value):
    """
    Parse a context tuple of the format 'key=type(value)'.
    """
    match = re.match(r'(\w+)=(\w+)\((.*?)\)', value)
    assert match, "could not parse '%s'" % value
    return match.group(1), eval(match.group(2))(match.group(3))