def METHOD_NAME(self, path, revision="HEAD"):
    """Return a previous commit for a given path starting from 'revision'."""
    def find_from_repository(path, revision):
        try:
            return self.repository.get_previous_commit(path=path, revision=revision, full_history=True)
        except errors.GitCommitNotFoundError:
            communication.warn(f"Cannot find previous commit for {path} from {str(revision)}")
            return revision
    try:
        path = (self.repository.path / path).relative_to(self.repository.path)
    except ValueError:
        pass
    path = str(path)
    if revision == "HEAD":
        revision = self.repository.head.commit
    commits = self.cache.get(git_unicode_unescape(path))
    if not commits:
        return find_from_repository(path, revision)
    if revision in commits:
        return revision
    for commit in commits:
        if commit.compare_to(revision) <= 0:
            return commit
    # No commit was found
    return find_from_repository(path, revision)