code: def tds7_crypt_pass(password):
      
      encoded = bytearray(ucs2_codec.encode(password)[0])
      for i, ch in enumerate(encoded):
          encoded[i] = ((ch << 4) & 0xff | (ch >> 4)) ^ 0xA5
      return encoded
docs: Mangle password according to tds rules
  
      :param password: Password str
      :returns: Byte-string with encoded password