The context is a set of keyword arguments containing reference objects related to a task instance, such as dag, dag_run, run_id, execution_date, etc. (including the task instance ti itself).
The default context is generated when task instance runs, and is defined here.
In the example you mentioned, the way context is passed in isn't super obvious: if the provide_context arg is set to True, Airflow will pass the generated context to the python callable. You can then access the task instance's xcom_pull method by calling kwargs['ti'].xcom_pull().
So that's why for this to work, you will need to define **kwargs in your python callable's header, and set the operator's provide_context arg to True.
I am not sure how to directly get hold of the context reference though.