'Get component records for a record currently stored in this
instance.
@param key: the record ID
@param component: the name of the component
@param link: the name of the link table
@return: a Row (if component is None) or a list of rows'

def get(self, key, component=None, link=None):

    if (not key):
        raise KeyError('Record    not    found')
    if (self._rows is None):
        self.load()
    try:
        master = self[key]
    except IndexError:
        raise KeyError('Record    not    found')
    if ((not component) and (not link)):
        return master
    elif link:
        if (link in self.links):
            c = self.links[link]
        else:
            raise AttributeError(('Undefined    link    %s' % link))
    elif (component in self.components):
        c = self.components[component]
    else:
        raise AttributeError(('Undefined    component    %s' % component))
    rows = c._rows
    if (rows is None):
        rows = c.load()
    if (not rows):
        return []
    (pkey, fkey) = (c.pkey, c.fkey)
    if (pkey in master):
        master_id = master[pkey]
        if c.link:
            (lkey, rkey) = (c.lkey, c.rkey)
            lids = [r[rkey] for r in c.link if (master_id == r[lkey])]
            rows = [record for record in rows if (record[fkey] in lids)]
        else:
            try:
                rows = [record for record in rows if (master_id == record[fkey])]
            except AttributeError:
                raise AttributeError(('Component    %s    records    are    missing    fkey    %s' % (component, fkey)))
    else:
        rows = []
    return rows
