code: def ssh_init_sec_context(
          self, target, desired_mech=None, username=None, recv_token=None
      ):
          
          from pyasn1.codec.der import decoder
  
          self._username = username
          self._gss_host = target
          targ_name = gssapi.Name(
              "host@" + self._gss_host, gssapi.C_NT_HOSTBASED_SERVICE
          )
          ctx = gssapi.Context()
          ctx.flags = self._gss_flags
          if desired_mech is None:
              krb5_mech = gssapi.OID.mech_from_string(self._krb5_mech)
          else:
              mech, __ = decoder.decode(desired_mech)
              if mech.__str__() != self._krb5_mech:
                  raise SSHException("Unsupported mechanism OID.")
              else:
                  krb5_mech = gssapi.OID.mech_from_string(self._krb5_mech)
          token = None
          try:
              if recv_token is None:
                  self._gss_ctxt = gssapi.InitContext(
                      peer_name=targ_name,
                      mech_type=krb5_mech,
                      req_flags=ctx.flags,
                  )
                  token = self._gss_ctxt.step(token)
              else:
                  token = self._gss_ctxt.step(recv_token)
          except gssapi.GSSException:
              message = "{} Target: {}".format(sys.exc_info()[1], self._gss_host)
              raise gssapi.GSSException(message)
          self._gss_ctxt_status = self._gss_ctxt.established
          return token
docs: Initialize a GSS-API context.
  
          :param str username: The name of the user who attempts to login
          :param str target: The hostname of the target to connect to
          :param str desired_mech: The negotiated GSS-API mechanism
                                   ("pseudo negotiated" mechanism, because we
                                   support just the krb5 mechanism :-))
          :param str recv_token: The GSS-API token received from the Server
          :raises:
              `.SSHException` -- Is raised if the desired mechanism of the client
              is not supported
          :return: A ``String`` if the GSS-API has returned a token or
              ``None`` if no token was returned