'Write an object to the pack file if not present and return its id.'

def maybe_write(self, type, content):

    sha = calc_hash(type, content)
    if (not self.exists(sha)):
        self.just_write(sha, type, content)
        self._require_objcache()
        self.objcache.add(sha)
    return sha
