code: def make_matrix(data, expected_rank, entries, column_names=None):
      termlist = make_termlist(*entries)
  
      def iter_maker():
          yield data
  
      design_infos = design_matrix_builders(
          [termlist], iter_maker, eval_env=0
      )
      matrices = build_design_matrices(design_infos, data)
      matrix = matrices[0]
      assert (
          design_infos[0].term_slices == matrix.design_info.term_slices
      )
      assert (
          design_infos[0].column_names
          == matrix.design_info.column_names
      )
      assert matrix.design_info is design_infos[0]
      check_design_matrix(
          matrix, expected_rank, termlist, column_names=column_names
      )
      return matrix
  
imports: from __future__ import print_function
  import six
  import numpy
  import pytest
  from patsy import PatsyError
  from patsy.util import atleast_2d_column_default, have_pandas, have_pandas_categorical
  from patsy.desc import Term, INTERCEPT
  from patsy.build import *
  from patsy.categorical import C
  from patsy.user_util import balanced, LookupFactor
  from patsy.design_info import DesignMatrix, DesignInfo
label_desc: Use image node_id 5 for calling a global function with example usage: make_matrix(data, expected_rank, entries, column_names) and returns: matrix