  Deriving the Feynman rules for lattice perturbation theory from actions and
operators is complicated, especially when improvement terms are present. This
physically important task is, however, suitable for automation. We describe a
flexible algorithm for generating Feynman rules for a wide range of lattice
field theories including gluons, relativistic fermions and heavy quarks. We
also present an efficient implementation of this in a freely available,
multi-platform programming language (\python), optimised to deal with a wide
class of lattice field theories.
