Implementing features directly in python


I would like to add some features ( say a function foo() )
in gr-trellis that is not implemented in c++ but directly
in python. So in my programs when I do

from gnuradio import trellis

I would like to have access to

how do I do that?
in particular, where should the python file reside
and how should I change the file?
is there an example of this in gnuradio?