code: def get_op_key(self, operation=None, arg=None):
          
          validops = self._params.get('key_ops',
                                      list(JWKOperationsRegistry.keys()))
          if validops is not list:
              validops = [validops]
          if operation is None:
              if self._params['kty'] == 'oct':
                  return self._key['k']
              raise InvalidJWKOperation(operation, validops)
          elif operation == 'sign':
              self._check_constraints('sig', operation)
              return self._get_private_key(arg)
          elif operation == 'verify':
              self._check_constraints('sig', operation)
              return self._get_public_key(arg)
          elif operation == 'encrypt' or operation == 'wrapKey':
              self._check_constraints('enc', operation)
              return self._get_public_key(arg)
          elif operation == 'decrypt' or operation == 'unwrapKey':
              self._check_constraints('enc', operation)
              return self._get_private_key(arg)
          else:
              raise NotImplementedError
docs: Get the key object associated to the requested opration.
          For example the public RSA key for the 'verify' operation or
          the private EC key for the 'decrypt' operation.
  
          :param operation: The requested operation.
           The valid set of operations is availble in the
           :data:`JWKOperationsRegistry` registry.
          :param arg: an optional, context specific, argument
           For example a curve name.
  
          :raises InvalidJWKOperation: if the operation is unknown or
           not permitted with this key.
          :raises InvalidJWKUsage: if the use constraints do not permit
           the operation.