code: def read_pfm(file):
      """Read a pfm file"""
      file = open(file, "rb")
  
      color = None
      width = None
      height = None
      scale = None
      endian = None
  
      header = file.readline().rstrip()
      header = str(bytes.decode(header, encoding="utf-8"))
      if header == "PF":
          color = True
      elif header == "Pf":
          color = False
      else:
          raise Exception("Not a PFM file.")
  
      temp_str = str(bytes.decode(file.readline(), encoding="utf-8"))
      dim_match = re.match(r"^(\d+)\s(\d+)\s$", temp_str)
      if dim_match:
          width, height = map(int, dim_match.groups())
      else:
          raise Exception("Malformed PFM header.")
  
      scale = float(file.readline().rstrip())
      if scale < 0:  # little-endian
          endian = "<"
          scale = -scale
      else:
          endian = ">"  # big-endian
  
      data = np.fromfile(file, endian + "f")
      shape = (height, width, 3) if color else (height, width)
  
      data = np.reshape(data, shape)
      # DEY: I don't know why this was there.
      # data = np.flipud(data)
      file.close()
  
      return data, scale
  
imports: import numpy
  import math
  import time
  import sys
  import os
  import inspect
  import re
  import uuid
  from collections import abc
  import textwrap
  from functools import wraps
  import gc
  import timeit
label_desc: Use image node_id 21 for calling a global function with example usage: read_pfm(file) and returns: data,  scale