def get_duplicates(fields):
 cnt = {}
 for field in fields:
  try:
   cnt[field] += 1
  except KeyError:
   cnt[field] = 1
 return [key for key in cnt.keys() if (cnt[key] > 1)]

def get_duplicates ( fields ) : cnt = { } for field in fields : try : cnt [ field ] += 1 except KeyError : cnt [ field ] = 1 return [ key for key in cnt . keys ( ) if ( cnt [ key ] > 1 ) ]
returns duplicates out of a list modified from stackoverflow .