def drain(stream):
    """
    A function wrapper around the `bytearray` data type. Can be used as the final sink in
    a refinery pipeline in Python code, i.e.:

        from refinery import *
        # ...
        output = data | carve('b64', single=True) | b64 | zl | drain
        assert isinstance(output, bytearray)
    """
    return bytearray(stream)