def dist(self, src, tar):
if src == tar:<EOL><INDENT>return <NUM_LIT:0.0><EOL><DEDENT>src = src.encode('<STR_LIT:utf-8>')<EOL>tar = tar.encode('<STR_LIT:utf-8>')<EOL>src_comp = bz2.compress(src, self._level)[<NUM_LIT:10>:]<EOL>tar_comp = bz2.compress(tar, self._level)[<NUM_LIT:10>:]<EOL>concat_comp = bz2.compress(src + tar, self._level)[<NUM_LIT:10>:]<EOL>concat_comp2 = bz2.compress(tar + src, self._level)[<NUM_LIT:10>:]<EOL>return (<EOL>min(len(concat_comp), len(concat_comp2))<EOL>- min(len(src_comp), len(tar_comp))<EOL>) / max(len(src_comp), len(tar_comp))<EOL>
Return the NCD between two strings using bzip2 compression.

        Parameters
        ----------
        src : str
            Source string for comparison
        tar : str
            Target string for comparison

        Returns
        -------
        float
            Compression distance

        Examples
        --------
        >>> cmp = NCDbz2()
        >>> cmp.dist('cat', 'hat')
        0.06666666666666667
        >>> cmp.dist('Niall', 'Neil')
        0.03125
        >>> cmp.dist('aluminum', 'Catalan')
        0.17647058823529413
        >>> cmp.dist('ATCG', 'TAGC')
        0.03125