def create_computer(self, computer, password):
        """
        Create a computer account on the domain.

        @computer: the name of the create computer.
        @password: the password of the computer to create.

        @return the result code on the add action
        """
        computer_dn = f"CN={computer},CN=Computers,{self.base_dn}"
        domain = ".".join(part.split("=")[1] for part in self.base_dn.split(","))
        # Default computer SPNs
        spns = [
            f"HOST/{computer.strip('$')}",
            f"HOST/{computer.strip('$')}.{domain}",
            f"RestrictedKrbHost/{computer.strip('$')}",
            f"RestrictedKrbHost/{computer.strip('$')}.{domain}",
        ]
        ucd = {
            "dnsHostName": "%s.%s" % (computer.strip("$"), domain),
            "userAccountControl": 0x1000,  # WORKSTATION_TRUST_ACCOUNT
            "servicePrincipalName": spns,
            "sAMAccountName": computer,
            "unicodePwd": ('"%s"' % password).encode("utf-16-le"),
        }
        try:
            result = self.ldap.add(
                computer_dn,
                ["top", "person", "organizationalPerson", "user", "computer"],
                ucd,
            )
        except Exception as e:
            raise self.ActiveDirectoryLdapException(e)
        return result

        Create a computer account on the domain.

        @computer: the name of the create computer.
        @password: the password of the computer to create.

        @return the result code on the add action
        
ldeep/views/ldap_activedirectory.py