code: def extract_status_code(error):
      
      try:
          return int(error.code)
      except (AttributeError, TypeError, ValueError):
          try:
              return int(error.status_code)
          except (AttributeError, TypeError, ValueError):
              try:
                  return int(error.errno)
              except (AttributeError, TypeError, ValueError):
                  return 500
docs: Extract an error code from a message.