def isBool(x):
    """ Returns True, if x is a boolean.
    >>> isBool(True)
    True
    >>> isBool(False)
    True
    >>> isBool(1)
    True
    >>> isBool(0)
    True
    >>> isBool(2)
    False
    >>> isBool('true')
    False
    """
    if isinstance(x, int) and x in [0, 1]:
        return True
    return isinstance(x, bool)
