def METHOD_NAME(table: Table, cols: List[str] = None) -> pa.Table:
    """Produces a pyarrow table from a Deephaven table
    Args:
        table (Table): the source table
        cols (List[str]): the source column names, default is None which means including all columns
    Returns:
        a pyarrow table
    Raise:
        DHError
    """
    try:
        if cols:
            table = table.view(formulas=cols)
        j_arrow_builder = _JTableToArrowConverter(table.j_table);
        pa_schema_buffer = j_arrow_builder.getSchema()
        with pa.ipc.open_stream(pa.py_buffer(pa_schema_buffer)) as reader:
            schema = reader.schema
        record_batches = []
        while j_arrow_builder.hasNext():
            pa_rb_buffer = j_arrow_builder.next()
            message = pa.ipc.read_message(pa_rb_buffer)
            record_batch = pa.ipc.read_record_batch(message, schema=schema)
            record_batches.append(record_batch)
        return pa.Table.from_batches(record_batches, schema=schema)
    except Exception as e:
        raise DHError(e, message="failed to create a pyarrow table from a Deephaven table.") from e