import re


def find_num_inquiries(Aop, parameters_size):
    """
    Find the number of parameter inquiries. Parameter inquiries may not be the
    same as the length of parameters array. The "parameter size" is the product
    of the "number of the parameter inquiries" and the "number of the
    parameters of the operator".
    """

    # Get number of parameters that the linear operator Aop defined with
    num_operator_parameters = Aop.get_num_parameters()

    # Find the number of inquiries based on the number of parameters
    # and the length (size) of the parameters array (or scalar)
    if num_operator_parameters == 0:

        # No parameters given. There is only one inquiry to be computed
        num_inquiries = 1

    elif parameters_size < num_operator_parameters:
        message = """Not enough parameters are provided. The given parameter
                     size is %d, which should be larger than %d, the number of
                     parameters of the linear operator.""" % (
                        parameters_size, num_operator_parameters)
        raise ValueError(re.sub(' +', ' ', message.replace('\n', '')))

    elif parameters_size % num_operator_parameters != 0:
        message = """Parameters size (given %d) is not an integer-multiple of
                     %d, the number of the parameters of the linear operator.
                     """ % (parameters_size, num_operator_parameters)
        raise ValueError(re.sub(' +', ' ', message.replace('\n', '')))

    else:
        # parameters size should be an integer multiple of num parameters
        num_inquiries = int(parameters_size / num_operator_parameters)

    return num_inquiries