code: def validate_usage(self, key_usage, extended_key_usage=None, extended_optional=False):
          
  
          self._validate_path()
          validate_usage(
              self._context,
              self._certificate,
              key_usage,
              extended_key_usage,
              extended_optional
          )
          return self._path
docs: Validates the certificate path and that the certificate is valid for
          the key usage and extended key usage purposes specified.
  
          :param key_usage:
              A set of unicode strings of the required key usage purposes. Valid
              values include:
  
               - "digital_signature"
               - "non_repudiation"
               - "key_encipherment"
               - "data_encipherment"
               - "key_agreement"
               - "key_cert_sign"
               - "crl_sign"
               - "encipher_only"
               - "decipher_only"
  
          :param extended_key_usage:
              A set of unicode strings of the required extended key usage
              purposes. These must be either dotted number OIDs, or one of the
              following extended key usage purposes:
  
               - "server_auth"
               - "client_auth"
               - "code_signing"
               - "email_protection"
               - "ipsec_end_system"
               - "ipsec_tunnel"
               - "ipsec_user"
               - "time_stamping"
               - "ocsp_signing"
               - "wireless_access_points"
  
              An example of a dotted number OID:
  
               - "1.3.6.1.5.5.7.3.1"
  
          :param extended_optional:
              A bool - if the extended_key_usage extension may be ommited and still
              considered valid
  
          :raises:
              certvalidator.errors.PathValidationError - when an error occurs validating the path
              certvalidator.errors.RevokedError - when the certificate or another certificate in its path has been revoked
              certvalidator.errors.InvalidCertificateError - when the certificate is not valid for the usages specified
  
          :return:
              A certvalidator.path.ValidationPath object of the validated
              certificate validation path