'Removes lines matching regex from remote_file'

def remove_lines_from_file(self, remote_file, regex):

    if (regex in [None, '']):
        log.debug('no    regex    supplied...returning')
        return
    lines = self.get_remote_file_lines(remote_file, regex, matching=False)
    log.debug(('new    %s    after    removing    regex    (%s)    matches:\n%s' % (remote_file, regex, ''.join(lines))))
    f = self.remote_file(remote_file)
    f.writelines(lines)
    f.close()
