'Returns list of lines in a remote_file
If regex is passed only lines that contain a pattern that matches
regex will be returned
If matching is set to False then only lines *not* containing a pattern
that matches regex will be returned'

def get_remote_file_lines(self, remote_file, regex=None, matching=True):

    f = self.remote_file(remote_file, 'r')
    flines = f.readlines()
    f.close()
    if (regex is None):
        return flines
    r = re.compile(regex)
    lines = []
    for line in flines:
        match = r.search(line)
        if (matching and match):
            lines.append(line)
        elif ((not matching) and (not match)):
            lines.append(line)
    return lines
