def _prepend_mean(arr, pad_amt, num, axis=-<NUM_LIT:1>):
if pad_amt == <NUM_LIT:0>:<EOL><INDENT>return arr<EOL><DEDENT>if num == <NUM_LIT:1>:<EOL><INDENT>return _prepend_edge(arr, pad_amt, axis)<EOL><DEDENT>if num is not None:<EOL><INDENT>if num >= arr.shape[axis]:<EOL><INDENT>num = None<EOL><DEDENT><DEDENT>mean_slice = tuple(slice(None) if i != axis else slice(num)<EOL>for (i, x) in enumerate(arr.shape))<EOL>pad_singleton = tuple(x if i != axis else <NUM_LIT:1><EOL>for (i, x) in enumerate(arr.shape))<EOL>mean_chunk = arr[mean_slice].mean(axis).reshape(pad_singleton)<EOL>_round_ifneeded(mean_chunk, arr.dtype)<EOL>return np.concatenate((mean_chunk.repeat(pad_amt, axis).astype(arr.dtype),<EOL>arr), axis=axis)<EOL>
Prepend `pad_amt` mean values along `axis`.

Parameters
----------
arr : ndarray
    Input array of arbitrary shape.
pad_amt : int
    Amount of padding to prepend.
num : int
    Depth into `arr` along `axis` to calculate mean.
    Range: [1, `arr.shape[axis]`] or None (entire axis)
axis : int
    Axis along which to pad `arr`.

Returns
-------
padarr : ndarray
    Output array, with `pad_amt` values prepended along `axis`. The
    prepended region is the mean of the first `num` values along `axis`.