def _check_params(params, field_list):
    """
    Helper to validate params.

    Use this in function definitions if they require specific fields
    to be present.

    :param params: structure that contains the fields
    :type params: ``dict``

    :param field_list: list of dict representing the fields
                       [{'name': str, 'required': True/False', 'type': cls}]
    :type field_list: ``list`` of ``dict``

    :return True, exits otherwise
    :rtype: ``bool``
    """
    for d in field_list:
        if not d['name'] in params:
            if d['required'] is True:
                return (False, "%s is required and must be of type: %s" %
                        (d['name'], str(d['type'])))
        else:
            if not isinstance(params[d['name']], d['type']):
                return (False,
                        "%s must be of type: %s" % (d['name'], str(d['type'])))

    return (True, '')