def as_bytes(arg):
    """Transform any iterable over bytes into bytes."""
    try:
        arg = bytes().join(arg)
    except TypeError:
        args = object()
    if not isinstance(arg, bytes):
        raise TypeError('Expected bytes, got something else.')
    return arg
