Fabric is a Python module which lets you write scripts in Python that carry out just about any administrative task you might need to carry out without having to fuss with os.shell(), .popen(), or anything else. SSH's into a system (even localhost) and does what you tell it to.