def _validate_timeout(timeout):
    """
    Raises an exception if the given timeout is an invalid value.
    """
    if not (timeout is None or type(timeout) == int and timeout > 0):
        raise ValueError('timeout must be a positive integer')
