code: def capabilityCheck(self, optional=None, required=None):
          
          res = self.query(
              "version", {"optional": optional or [], "required": required or []}
          )
  
          if not self._hasprop(res, "capabilities"):
              # Server doesn't support capabilities, so we need to
              # synthesize the results based on the version
              capabilities.synthesize(res, optional)
              if "error" in res:
                  raise CommandError(res["error"])
  
          return res
docs: Perform a server capability check