<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generic_function(target, prop, func, **kwargs):
 r""" Runs an arbitrary function on the given data This allows users to place a customized calculation into the automatated model regeneration pipeline. Parameters target : OpenPNM Object The object which this model is associated with. This controls the length of the calculated array, and also provides access to other necessary properties. prop : string The dictionary key containing the array to be operated on func : Numpy function A handle to the function to apply kwargs : keyward arguments All arguments required by the specific Numpy function Examples -------- The following example shows how to use a Numpy function, but any function can be used, as long as it returns an array object: """

    values = target[prop]
    result = func(values, **kwargs)
    if not isinstance(result, np.ndarray):
        logger.warning('Given function must return a Numpy array')
    return result