human
Complete the below
def makeModCGILinks(movieTxt, personTxt, characterTxt=None, encoding='latin_1'):

    ''''Make a function used to pretty-print movies and persons refereces;
    movieTxt and personTxt are the strings used for the substitutions.
    movieTxt must contains %(movieID)s and %(title)s, while personTxt
    must contains %(personID)s and %(name)s and characterTxt %(characterID)s
    and %(name)s.
characterTxt is optional, for backward compatibility.'
    '''
 ... Give me a Python program to print movies and persons refereces;?
assistant
#Here is Python program to print movies and persons refereces;
.
    _cgiPrint = makeCgiPrintEncoding(encoding)
    def modCGILinks(s, titlesRefs, namesRefs, characterRefs=None):
        'Substitute    movies    and    persons    references.'
        if (characterRefs is None):
            characterRefs = {}
        def _replaceMovie(match):
            to_replace = match.group(1)
            item = titlesRefs.get(to_replace)
            if item:
                movieID = item.movieID
                to_replace = (movieTxt % {'movieID': movieID, 'title': unicode(_cgiPrint(to_replace), encoding, 'xmlcharrefreplace')})
            return to_replace
        def _replacePerson(match):
            to_replace = match.group(1)
            item = namesRefs.get(to_replace)
            if item:
                personID = item.personID
                to_replace = (personTxt % {'personID': personID, 'name': unicode(_cgiPrint(to_replace), encoding, 'xmlcharrefreplace')})
            return to_replace
        def _replaceCharacter(match):
            to_replace = match.group(1)
            if (characterTxt is None):
                return to_replace
            item = characterRefs.get(to_replace)
            if item:
                characterID = item.characterID
                if (characterID is None):
                    return to_replace
                to_replace = (characterTxt % {'characterID': characterID, 'name': unicode(_cgiPrint(to_replace), encoding, 'xmlcharrefreplace')})
            return to_replace
        s = s.replace('<', '&lt;').replace('>', '&gt;')
        s = _re_hrefsub('<a    href="\\1">\\1</a>', s)
        s = re_titleRef.sub(_replaceMovie, s)
        s = re_nameRef.sub(_replacePerson, s)
        s = re_characterRef.sub(_replaceCharacter, s)
        return s
    modCGILinks.movieTxt = movieTxt
    modCGILinks.personTxt = personTxt
    modCGILinks.characterTxt = characterTxt
    return modCGILinks