def get_changectx_for_changeset(repo, changeset_revision, **kwd):
    """Retrieve a specified changectx from a repository."""
    for changeset in repo.changelog:
        ctx = repo.changectx(changeset)
        if str(ctx) == changeset_revision:
            return ctx
    return None