def bytearray_check(*args, func=None):
    """Check if arguments are bytearray type."""
    func = func or inspect.stack()[2][3]
    for var in args:
        if not isinstance(var, (bytearray, collections.abc.ByteString, collections.abc.MutableSequence)):
            name = type(var).__name__
            raise BytearrayError(
                f'Function {func} expected bytearray, {name} got instead.')
Check if arguments are bytearray type.