Which of the following is the best definition of "O Captain! My Captain!"?

an elegy written by Walt Whitman celebrating a Civil War victory
an elegy written by Walt Whitman mourning and praising Lincoln
a eulogy written by Walt Whitman praising Lincoln
an elegy written by Walt Whitman expressing sorrow over the South's loss of the Civil War