def METHOD_NAME(self, replacement):
    # twisted's 'patch' doesn't handle the case where an attribute
    # doesn't exist..
    if hasattr(os, 'uname'):
        self.patch(os, 'uname', replacement)
    else:
        def cleanup():
            del os.uname
        self.addCleanup(cleanup)
        os.uname = replacement