def check_inputs(compulsory_fields, fields):
    """Helper function to check if the layer has every compulsory fields.

    :param compulsory_fields: List of compulsory fields.
    :type compulsory_fields: list

    :param fields: inasafe_field dictionary from the layer.
    :type fields: dict

    :raises: InvalidKeywordsForProcessingAlgorithm if the layer is not valid.
    """
    for field in compulsory_fields:
        # noinspection PyTypeChecker
        if not fields.get(field['key']):
            # noinspection PyTypeChecker
            msg = '%s not found in %s' % (field['key'], fields)
            raise InvalidKeywordsForProcessingAlgorithm(msg)
Helper function to check if the layer has every compulsory fields.

    :param compulsory_fields: List of compulsory fields.
    :type compulsory_fields: list

    :param fields: inasafe_field dictionary from the layer.
    :type fields: dict

    :raises: InvalidKeywordsForProcessingAlgorithm if the layer is not valid.