code: def read_exr(filename, channel_names=None):
      """Opens an EXR file and copies the requested channels into an ndarray.
  
      The Python OpenEXR wrapper uses a dictionary for the channel header, so the
      ordering of the channels in the underlying file is lost. If channel_names is
      not passed, this function orders the output channels with any present RGBA
      channels first, followed by the remaining channels in alphabetical order.
      By convention, RGBA channels are named 'R', 'G', 'B', 'A', so this function
      looks for those strings.
  
      Args:
        filename: The name of the EXR file.
        channel_names: A list of strings naming the channels to read. If None, all
          channels will be read.
  
      Returns:
        A numpy array containing the image data, and a list of the corresponding
          channel names.
      """
      exr = OpenEXR.InputFile(filename)
      if channel_names is None:
          remaining_channel_names = list(
              exr.header()["channels"].keys()
          )
          conventional_rgba_names = ["R", "G", "B", "A"]
          present_rgba_names = []
          # Pulls out any present RGBA names in RGBA order.
          for name in conventional_rgba_names:
              if name in remaining_channel_names:
                  present_rgba_names.append(name)
                  remaining_channel_names.remove(name)
          channel_names = present_rgba_names + sorted(
              remaining_channel_names
          )
  
      return channels_to_ndarray(exr, channel_names), channel_names
  
file_path: graphics/tensorflow_graphics/io/exr.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import Imath
  import numpy
  import OpenEXR
  from six.moves import range
  from six.moves import zip
label_desc: Use image node_id 2 for calling a global function with example usage: read_exr(filename, channel_names) and returns: channels_to_ndarray,  channel_names