'Helper method to find the link table entry ID for
a pair of linked records.
@param master_id: the ID of the master record
@param component_id: the ID of the component record'

def link_id(self, master_id, component_id):

    if ((self.parent is None) or (self.linked is None)):
        return None
    join = self.get_join()
    ltable = self.table
    mtable = self.parent.table
    ctable = self.linked.table
    query = ((join & (mtable._id == master_id)) & (ctable._id == component_id))
    row = current.db(query).select(ltable._id, limitby=(0, 1)).first()
    if row:
        return row[ltable._id.name]
    else:
        return None
