SimProp: a simulation code for ultra high energy cosmic ray propagation