'Get the object for a ref SHA, only looking in this pack.'

def get_ref(self, sha):

    if (self.pack is None):
        raise KeyError(sha)
    try:
        offset = self.pack.index.object_index(sha)
    except KeyError:
        offset = None
    if offset:
        (type, obj) = self.get_object_at(offset)
    elif ((self.pack is not None) and self.pack.resolve_ext_ref):
        (type, obj) = self.pack.resolve_ext_ref(sha)
    else:
        raise KeyError(sha)
    return (offset, type, obj)
