'shape should be a function taking and returning numeric type.
For sanity it should always return positive or zero but this isn\'t
enforced in case you want to do weird things. Bear in mind that the
statistical tests etc. may not be valid for non-positive kernels.
The bandwidth of the kernel is supplied as h.
You may specify a domain as a list of 2 values [min, max], in which case
kernel will be treated as zero outside these values. This will speed up
calculation.
You may also specify the normalisation constant for the supplied Kernel.
If you do this number will be stored and used as the normalisation
without calculation.  It is recommended you do this if you know the
constant, to speed up calculation.  In particular if the shape function
provided is already normalised you should provide norm = 1.0.
Warning: I think several calculations assume that the kernel is
normalized. No tests for non-normalized kernel.'

def __init__(self, shape, h=1.0, domain=None, norm=None):

    self._normconst = norm
    self.domain = domain
    self.weights = None
    if callable(shape):
        self._shape = shape
    else:
        raise TypeError('shape    must    be    a    callable    object/function')
    self._h = h
    self._L2Norm = None
    self._kernel_var = None
    self._normal_reference_constant = None
    self._order = None
