import json


def chk_err_in_payload(json_payload, exc: bool = True):
    """
    Check if there are error(s) indicated in response.

    :param json_payload:
    :param exc: Should raise exception if error found.
    """
    err_fields = {'error', 'errors'}
    for errf in err_fields:
        if errf in json_payload and json_payload[errf]:
            if exc:
                raise RuntimeError(f'Response marked with {errf}: {json.dumps(json_payload[errf])}')
            else:
                return True