how to add a driver to the z local axis of an empty using python?

I want to add a driver to the z local axis of an empty,and I will use a single property variable (extra information),so how can I do this?
and how can I add an empty that is aligned to the view,I try to make by make the align to view true but this didn’t work,I don’t know why,so how can I did this