code: def hdfs_fs():
      if should_skip(HDFS_URI):
          yield [None] * NUM_ATR_FS
          return
  
      from pyarrow.fs import HadoopFileSystem
  
      monkeypatch = pytest.MonkeyPatch()
      hdfs_host = os.environ.get("HDFS_HOST")
      hdfs_port = int(os.environ.get("HDFS_PORT", 9000))
  
      if hdfs_host is None:
          hdfs_host = socket.gethostbyname(socket.gethostname())
  
      hdfs = HadoopFileSystem(hdfs_host, hdfs_port)
  
      def path_to(*args):
          return f"{HDFS_URI}://{hdfs_host}:{hdfs_port}/{posixpath.join(ROOT_PREFIX, *args)}"
  
      def read(path):
          f = hdfs.open_input_stream(path)
          return f.readall()
  
      def write(path, body):
          with hdfs.open_output_stream(path) as f:
              f.write(body)
  
      def mkdirs(path):
          hdfs.create_dir(path, recursive=True)
  
      yield path_to, read, write, mkdirs, posixpath.join, None
      monkeypatch.undo()
  
imports: import functools
  import os
  import posixpath
  import random
  import socket
  import sys
  import time
  from urllib.parse import urlparse
  import pytest
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 9 for calling a global function with example usage: hdfs_fs() and returns: HDFS_URI, str, hdfs_host, str, hdfs_port, str, posixpath, f