def strip_internal_keys(dirty):
 clean = dirty.copy()
 for k in dirty.keys():
  if (isinstance(k, string_types) and k.startswith('_ansible_')):
   del clean[k]
  elif isinstance(dirty[k], dict):
   clean[k] = strip_internal_keys(dirty[k])
 return clean

def strip_internal_keys ( dirty ) : clean = dirty . copy ( ) for k in dirty . keys ( ) : if ( isinstance ( k , string_types ) and k . startswith ( '_ansible_' ) ) : del clean [ k ] elif isinstance ( dirty [ k ] , dict ) : clean [ k ] = strip_internal_keys ( dirty [ k ] ) return clean
all keys stating with _ansible_ are internal .