'Attempt to extract the haproxy version.
Return a tuple containing major and minor version.'

def discover_version(self):

    data = self.execute('show    info', 200, False)
    lines = data.splitlines()
    line = [x for x in lines if ('Version:' in x)]
    try:
        version_values = line[0].partition(':')[2].strip().split('.', 3)
        version = (int(version_values[0]), int(version_values[1]))
    except (ValueError, TypeError, IndexError):
        version = None
    return version
