I have Just opted the below code which is working fine to determine the duplicate line and line numbers and this works fine.
from collections import defaultdict
def find_dupl(log):
    output = defaultdict(list)
    with open(log) as f:
        for i, line in enumerate(f):
            line = line.strip()
            output[line].append(i)
        print({k: v for k, v in output.items() if len(v) > 1})
find_dupl('rhel65')
The result output is as follows, i every host name or item to be printed into new line.
{'hostlab01': [0, 1], 'hostlab02': [34, 35, 36]}
Desired would be :
hostlab01: [0, 1] hostlab02: [34, 35, 36]
 
     
    