def return_type_from_signature(sig):
    """
    Returns the string representation of the JSON type returned by a method
    (for use in ``jsonrpc.types.JSONRPCType``), based on a provided signature.

    Usage:

    >>> return_type_from_signature('spam_eggs(arg=<str>, arg2=<str>) -> <str>')
    'str'
    >>>

    """
    try:
        r_type = re.match(SIG_RE, sig).group('rtype')
    except __HOLE__:
        raise ValueError(
            u'Method signature syntax "{sig}" is incorrect.'.format(sig=sig))
    if not r_type in JSONType.json_types:
        raise ValueError(
            u'Invalid return type "{r_type}". Allowed types are: '
            '{allowed}.'.format(
                r_type=r_type, allowed=', '.join(JSONType.json_types)))
    return r_type
dataset/ETHPy150Open orokusaki/django-jsonrpc-2-0/jsonrpc/signatures.py/return_type_from_signature