How to save a function in sage
I have a function in sage I want to save, but I cannot figure out how. I'm running sage on a mac through the terminal. I'm finding stuff online about save_session, or saving to a document.sage file or something but nothing really seems to be working, is there a straightforward way to do this? Thanks.
Edit: Also while I have your attention, say you have a function f, how do you display the contents of f without actually running it?