Fixed python plugin to work with new layer factory.

@Yangqing This addresses your second question.