def typematch(variable, expectedtype):
    """
    Check if a variable is a specific type

    :type variable: variable
    :param variable: The variable to check the type of

    :type expectedtype: type
    :param expectedtype: The type to check against

    >>> typematch(True, bool)
    True

    >>> typematch("foo", str)
    True

    >>> typematch(True, str)
    False

    >>> binboolflip("foo")
    Traceback (most recent call last):
      ...
    ValueError: Invalid item specified.
    """

    # Return the result
    return isinstance(variable, expectedtype)