code: def errno_from_exception(e):
      # type: (BaseException) -> Optional[int]
      """Provides the errno from an Exception object.
  
      There are cases that the errno attribute was not set so we pull
      the errno out of the args but if someone instantiates an Exception
      without any args you will get a tuple error. So this function
      abstracts all that behavior to give you a safe way to get the
      errno.
      """
  
      if hasattr(e, "errno"):
          return e.errno  # type: ignore
      elif e.args:
          return e.args[0]
      else:
          return None
  
imports: from __future__ import absolute_import, division, print_function
  import array
  import atexit
  import os
  import re
  import sys
  import zlib
label_desc: Use image node_id 4 for calling a global function with example usage: errno_from_exception(e) and returns: e, e, None