code: def path_to_bytes(path):
      r"""Converts input which is a `PathLike` object to `bytes`.
  
      Converts from any python constant representation of a `PathLike` object
      or `str` to bytes.
  
      Args:
        path: An object that can be converted to path representation.
  
      Returns:
        A `bytes` object.
  
      Usage:
        In case a simplified `bytes` version of the path is needed from an
        `os.PathLike` object.
      """
      if hasattr(path, "__fspath__"):
          path = path.__fspath__()
      return as_bytes(path)
  
file_path: tensorflow-upstream/tensorflow/python/util/compat.py
imports: import codecs
  import collections.abc
  import numbers
  import numpy
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 6 for calling a global function with example usage: path_to_bytes(path) and returns: as_bytes