code: def test_pandas_roundtrip_datetime(unit):
      if Version(pd.__version__) < Version("1.5.0"):
          pytest.skip("__dataframe__ added to pandas in 1.5.0")
      from datetime import datetime as dt
  
      # timezones not included as they are not yet supported in
      # the pandas implementation
      dt_arr = [dt(2007, 7, 13), dt(2007, 7, 14), dt(2007, 7, 15)]
      table = pa.table({"a": pa.array(dt_arr, type=pa.timestamp(unit))})
  
      if Version(pd.__version__) < Version("1.6"):
          # pandas < 2.0 always creates datetime64 in "ns"
          # resolution
          expected = pa.table(
              {"a": pa.array(dt_arr, type=pa.timestamp("ns"))}
          )
      else:
          expected = table
  
      from pandas.api.interchange import (
          from_dataframe as pandas_from_dataframe,
      )
  
      pandas_df = pandas_from_dataframe(table)
      result = pi.from_dataframe(pandas_df)
  
      assert expected.equals(result)
  
      expected_protocol = expected.__dataframe__()
      result_protocol = result.__dataframe__()
  
      assert (
          expected_protocol.num_columns()
          == result_protocol.num_columns()
      )
      assert expected_protocol.num_rows() == result_protocol.num_rows()
      assert (
          expected_protocol.num_chunks() == result_protocol.num_chunks()
      )
      assert (
          expected_protocol.column_names()
          == result_protocol.column_names()
      )
  
imports: from datetime import datetime
  import numpy
  import pyarrow
  from pyarrow.vendored.version import Version
  import pytest
  import pyarrow.interchange
  from pyarrow.interchange.column import _PyArrowColumn, ColumnNullType, DtypeKind
  from pyarrow.interchange.from_dataframe import _from_dataframe
label_desc: Use image node_id 9 for calling a global function with example usage: test_pandas_roundtrip_datetime(unit) without return types