'Return the imdbID for the given Movie, Person, Character or Company
object.'

def get_imdbID(self, mop):

    imdbID = None
    if (mop.accessSystem == self.accessSystem):
        aSystem = self
    else:
        aSystem = IMDb(mop.accessSystem)
    if isinstance(mop, Movie.Movie):
        if (mop.movieID is not None):
            imdbID = aSystem.get_imdbMovieID(mop.movieID)
        else:
            imdbID = aSystem.title2imdbID(build_title(mop, canonical=0, ptdf=0, appendKind=False), mop['kind'])
    elif isinstance(mop, Person.Person):
        if (mop.personID is not None):
            imdbID = aSystem.get_imdbPersonID(mop.personID)
        else:
            imdbID = aSystem.name2imdbID(build_name(mop, canonical=1))
    elif isinstance(mop, Character.Character):
        if (mop.characterID is not None):
            imdbID = aSystem.get_imdbCharacterID(mop.characterID)
        else:
            imdbID = aSystem.character2imdbID(build_name(mop, canonical=1))
    elif isinstance(mop, Company.Company):
        if (mop.companyID is not None):
            imdbID = aSystem.get_imdbCompanyID(mop.companyID)
        else:
            imdbID = aSystem.company2imdbID(build_company_name(mop))
    else:
        raise IMDbError((('object    ' + repr(mop)) + '    is    not    a    Movie,    Person    or    Character    instance'))
    return imdbID
