<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def get_cached(self, link, default=None):
        '''Retrieves a cached navigator from the id_map.

        Either a Link object or a bare uri string may be passed in.'''
        if hasattr(link, 'uri'):
            return self.id_map.get(link.uri, default)
        else:
            return self.id_map.get(link, default)