docstr: Create an arrow binary that can be loaded and manipulated from memory.
  
  Args:
      names (list): a list of str column names
      data (list): a list of lists containing data for each column
      types (list): an optional list of `pyarrow.type` function references.
          Types will be inferred if not provided.
      legacy (bool): if True, use legacy IPC format (pre-pyarrow 0.15). Defaults to False.
  
  Returns:
      bytes : a bytes object containing the arrow-serialized output.
docstr_tok: ["Create","an","arrow","binary","that","can","be","loaded","and","manipulated","from","memory",".","Args",":","names","(","list",")",":","a","list","of","str","column","names","data","(","list",")",":","a","list","of","lists","containing","data","for","each","column","types","(","list",")",":","an","optional","list","of","`","pyarrow.type","`","function","references",".","Types","will","be","inferred","if","not","provided",".","legacy","(","bool",")",":","if","True",",","use","legacy","IPC","format","(","pre-pyarrow","0.15",")",".","Defaults","to","False",".","Returns",":","bytes",":","a","bytes","object","containing","the","arrow-serialized","output","."]
code: def make_arrow(names, data, types=None, legacy=False):
      """Create an arrow binary that can be loaded and manipulated from memory.
  
      Args:
          names (list): a list of str column names
          data (list): a list of lists containing data for each column
          types (list): an optional list of `pyarrow.type` function references.
              Types will be inferred if not provided.
          legacy (bool): if True, use legacy IPC format (pre-pyarrow 0.15). Defaults to False.
  
      Returns:
          bytes : a bytes object containing the arrow-serialized output.
      """
      stream = pa.BufferOutputStream()
      arrays = []
  
      for idx, column in enumerate(data):
          # only apply types if array is present
          kwargs = {}
          if types:
              kwargs["type"] = types[idx]
          arrays.append(pa.array(column, **kwargs))
  
      batch = pa.RecordBatch.from_arrays(arrays, names)
      table = pa.Table.from_batches([batch])
      writer = pa.RecordBatchStreamWriter(
          stream, table.schema, use_legacy_format=legacy
      )
  
      writer.write_table(table)
      writer.close()
      return stream.getvalue().to_pybytes()
  
imports: from datetime import datetime
  import numpy
  import pandas
  import pyarrow
  from pytest import fixture
  from random import random, randint, choice
  from faker import Faker
label_desc: Use image node_id 1 for calling the Util obj's underlying member method code with example usage: obj.make_arrow(names, data, types, legacy) and returns: stream