@staticmethod
def _assert(condition=False, exception=Exception, message=None):
    """
        Checks condition and raises exception if it is wrong.

        :param bool condition: condition to check;
        :param BaseException exception: raised exception;
        :param str message: message for `exception(message)`;
        :raises exception: if `condition` is wrong.
        """
    if message is None:
        exc = exception
    else:
        exc = exception(message)
    if not condition:
        raise exc
