code: def pathlen(self):
          
  
          try:
              ext = self.x509.extensions.get_extension_for_oid(ExtensionOID.BASIC_CONSTRAINTS)
          except x509.ExtensionNotFound:  # pragma: no cover - extension should always be present
              return None
          return ext.value.path_length
docs: The ``pathlen`` attribute of the ``BasicConstraints`` extension (either an ``int`` or ``None``).