human
I wrote the below code

    from theano import compile, shared
    import theano.tensor
    from theano.tensor import as_tensor_variable, TensorType
    assert isinstance(pt, (list, tuple))
    pt = [np.array(p) for p in pt]
    for (i, p) in enumerate(pt):
        if (p.dtype not in ('float16', 'float32', 'float64')):
            raise TypeError(('verify_grad    can    work    only    with    floating    point    inputs,    but    input    %i    has    dtype    "%s".' % (i, p.dtype)))
    _type_tol = dict(float16=0.05, float32=0.01, float64=0.0001)
    if (abs_tol is None):
        abs_tol = builtins.max((_type_tol[str(p.dtype)] for p in pt))
    if (rel_tol is None):
        rel_tol = builtins.max((_type_tol[str(p.dtype)] for p in pt))
    if (rng is None):
        raise TypeError('rng    should    be    a    valid    instance    of    numpy.random.RandomState.    You    may    want    to    use    theano.tests.unittest_tools.verify_grad    instead    of    theano.gradient.verify_grad.')
    def function(inputs, output, name, mode=mode):
        f = compile.function(inputs, output, accept_inplace=True, allow_input_downcast=True, mode=mode, on_unused_input='ignore', name=name)
        return f
    tensor_pt = [TensorType(as_tensor_variable(p).dtype, as_tensor_variable(p).broadcastable)(name=('input    %i' % i)) for (i, p) in enumerate(pt)]
    o_output = fun(*tensor_pt)
    if isinstance(o_output, list):
        raise NotImplementedError('cant    (yet)    autotest    gradient    of    fun    with    multiple    outputs')
    o_fn = function(tensor_pt, o_output, name='gradient.py    fwd')
    o_fn_out = o_fn(*[p.copy() for p in pt])
    if (isinstance(o_fn_out, tuple) or isinstance(o_fn_out, list)):
        raise TypeError('It    seems    like    you    are    trying    to    use    verify_grad    on    an    op    or    a    function    which    outputs    a    list:    there    should    be    a    single    (array-like)    output    instead')
    def random_projection():
        plain = (rng.rand(*o_fn_out.shape) + 0.5)
       ...

What's a good function header?
assistant
#Here's a good function header.

def verify_grad(fun, pt, n_tests=2, rng=None, eps=None, out_type=None, abs_tol=None, rel_tol=None, mode=None, cast_to_output_type=False, no_debug_ref=True):