Add SSH public key to a user's profile.

        Args:
            username: Username to attach SSH public key to
            filename: Filename containing keys to add (optional)

        Raises:
            ldap3.core.exceptions.LDAPNoSuchAttributeResult:
                ldapPublicKey isn't attached to objectClass

def add(self, username, user_api, filename=None):
        """
        Add SSH public key to a user's profile.

        Args:
            username: Username to attach SSH public key to
            filename: Filename containing keys to add (optional)

        Raises:
            ldap3.core.exceptions.LDAPNoSuchAttributeResult:
                ldapPublicKey isn't attached to objectClass

        """
        keys = API.__get_keys(filename)
        user = user_api.find(username)[0]
        distinguished_name = user.entry_dn
        if 'ldapPublicKey' not in user.objectClass:
            raise ldap3.core.exceptions.LDAPNoSuchAttributeResult(
                'LDAP Public Key Object Class not found. ' +
                'Please ensure user was created correctly.')
        else:
            for key in list(set(keys)):  # prevents duplicate insertion
                print(key)
                try:
                    SSHKey(key).parse()
                except Exception as err:
                    raise err from None
                else:
                    operation = {'sshPublicKey': [(ldap3.MODIFY_ADD, [key])]}
                    self.client.modify(distinguished_name, operation)