def __init__(self, endpoint, username, password, delegation=False, **kwargs):
self.session = kwargs.get('<STR_LIT>', Session())<EOL>self.endpoint = endpoint<EOL>self.session.auth = Service._determine_auth_mechanism(username, password, delegation)<EOL>
# Kerberos authentication does not require a password if the MIT kerberos GSS-API mechanism already has a
# valid service ticket for the WSMAN service on the target server. However if the callee wishes to use
# credential delegation with Kerberos they must still provide a password (see Microsoft [MS-CSSP] Protocol)
#
# Credential delegation requires an authentication mechanism which provide message integrity and confidentiality
# such as NTLM or Kerberos; basic authentication cannot be used.
#
# Kerberos requires the username in UPN (RFC xxxx) form. UPN or NetBIOS usernames can be used whith NTLM
#
# when TCP connection is closed, its auto-opened
#