def encode(self, word, max_length=-<NUM_LIT:1>, zero_pad=False, retain_vowels=False):
<EOL>word = unicode_normalize('<STR_LIT>', text_type(word.upper()))<EOL>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>word = '<STR_LIT>'.join(c for c in word if c in self._uc_set)<EOL>sdx = word[:<NUM_LIT:1>] + word.translate(self._trans)<EOL>sdx = self._delete_consecutive_repeats(sdx)<EOL>if not retain_vowels:<EOL><INDENT>sdx = sdx.replace('<STR_LIT:0>', '<STR_LIT>')  <EOL><DEDENT>if max_length > <NUM_LIT:0>:<EOL><INDENT>if zero_pad:<EOL><INDENT>sdx += '<STR_LIT:0>' * max_length<EOL><DEDENT>sdx = sdx[:max_length]<EOL><DEDENT>return sdx<EOL>
Return the Refined Soundex code for a word.

        Parameters
        ----------
        word : str
            The word to transform
        max_length : int
            The length of the code returned (defaults to unlimited)
        zero_pad : bool
            Pad the end of the return value with 0s to achieve a max_length
            string
        retain_vowels : bool
            Retain vowels (as 0) in the resulting code

        Returns
        -------
        str
            The Refined Soundex value

        Examples
        --------
        >>> pe = RefinedSoundex()
        >>> pe.encode('Christopher')
        'C393619'
        >>> pe.encode('Niall')
        'N87'
        >>> pe.encode('Smith')
        'S386'
        >>> pe.encode('Schmidt')
        'S386'