def mock_res(name, data, args=[], kwargs={}):
    '\n    Given a name, data and call parameters, returns the mocked response\n\n    If there is no matching response, raises an exception that can be used to\n    prepare the mock data.\n\n    This can be used for situations where you mock some function like data;\n    for example at [Serverboards](https://serverboards.io), we use it to\n    mock RPC calls.\n\n    Its also used internally on every other mocking.\n    '
    data = data.get(name)
    if (not data):
        raise Exception(('unknown method for mocking: \n%s:\n  - args: %s\n    kwargs: %s\n    response: ...\n' % (name, json.dumps(args), json.dumps(kwargs))))
    for res in data:
        if (mock_match(args, res.get('args')) and mock_match(kwargs, res.get('kwargs', {}))):
            if ('error' in res):
                raise Exception(res['error'])
            response = res['response']
            if isinstance(response, (int, str)):
                return response
            return wrapped(response)
    raise Exception(('unknown data for mocking: \n%s:\n  - args: %s\n    kwargs: %s\n    response: ...\n' % (name, json.dumps(args), json.dumps(kwargs))))
Given a name, data and call parameters, returns the mocked response

If there is no matching response, raises an exception that can be used to
prepare the mock data.

This can be used for situations where you mock some function like data;
for example at [Serverboards](https://serverboards.io), we use it to
mock RPC calls.

Its also used internally on every other mocking.
def mock_res(name, data, args=[], kwargs={}):
    '\n    Given a name, data and call parameters, returns the mocked response\n\n    If there is no matching response, raises an exception that can be used to\n    prepare the mock data.\n\n    This can be used for situations where you mock some function like data;\n    for example at [Serverboards](https://serverboards.io), we use it to\n    mock RPC calls.\n\n    Its also used internally on every other mocking.\n    '
    data = data.get(name)
    if (not data):
        raise Exception(('unknown method for mocking: \n%s:\n  - args: %s\n    kwargs: %s\n    response: ...\n' % (name, json.dumps(args), json.dumps(kwargs))))
    for res in data:
        if (mock_match(args, res.get('args')) and mock_match(kwargs, res.get('kwargs', {}))):
            if ('error' in res):
                raise Exception(res['error'])
            response = res['response']
            if isinstance(response, (int, str)):
                return response
            return wrapped(response)
    raise Exception(('unknown data for mocking: \n%s:\n  - args: %s\n    kwargs: %s\n    response: ...\n' % (name, json.dumps(args), json.dumps(kwargs))))