def validate_not_none(valname, val):
    """Checks that val is not None

    :param valname: the name of the value being validated
    :type valname: string
    :param val: the value to be validated
    :type val: any
    """
    if val is not None:
        return val
    else:
        msg = valname + " must be instantiated with a non null value.\n"
        msg += "The value provided was None"
        raise TypeError(msg)