def METHOD_NAME(v, val=None):
    """Check if v is scalar, i.e. int, float or complex.
    Optional compare with val.
    Examples
    --------
    >>> import pygimli as pg
    >>> print(pg.isScalar(0))
    True
    >>> print(pg.isScalar(1.0))
    True
    >>> print(pg.isScalar(1.0, 0.0))
    False
    >>> print(pg.isScalar(1.0, 1.0))
    True
    >>> print(pg.isScalar(1+1j))
    True
    >>> print(pg.isScalar([0.0, 1.0]))
    False
    """
    if val is None:
        return isinstance(v, (int, float, complex, np.complex128))
    # maybe add some tolerance check
    return isinstance(v, (int, float, complex, np.complex128)) and v == val