f = open('/etc/ssh/sshd_config', 'r')
strings = re.search('^\\s*[^#]*IgnoreRhosts\\s+yes', f.read(), flags=re.
    MULTILINE)
print(strings.group(0))
Python regex search for string at beginning of line in file