'Given a long imdb canonical name, returns a personID or
None if not found.'

def _getNameID(self, name):

    nd = analyze_name(name)
    res = Name.select(AND((Name.q.name == self.toUTF8(nd['name'])), self._buildNULLCondition(Name.q.imdbIndex, nd.get('imdbIndex'))))
    try:
        c = res.count()
        if (res.count() != 1):
            return None
    except (UnicodeDecodeError, TypeError):
        return None
    return res[0].id
