'Get prefix, name and ID of an instance record
@param supertable: the super-entity table
@param superid: the super-entity record ID
@return: a tuple (prefix, name, ID) of the instance
record (if it exists)'

@classmethod
def get_instance(cls, supertable, superid):

    if (not hasattr(supertable, '_tablename')):
        supertable = cls.table(supertable)
    if (supertable is None):
        return (None, None, None)
    db = current.db
    query = (supertable._id == superid)
    entry = db(query).select(supertable.instance_type, supertable.uuid, limitby=(0, 1)).first()
    if entry:
        instance_type = entry.instance_type
        (prefix, name) = instance_type.split('_', 1)
        instancetable = current.s3db[entry.instance_type]
        query = (instancetable.uuid == entry.uuid)
        record = db(query).select(instancetable.id, limitby=(0, 1)).first()
        if record:
            return (prefix, name, record.id)
    return (None, None, None)
