def add_dictval_to_list(adict, key, alist):
 if (key in adict):
  if isinstance(adict[key], six.string_types):
   alist.append(adict[key])
  else:
   alist.extend(adict[key])

def add_dictval_to_list ( adict , key , alist ) : if ( key in adict ) : if isinstance ( adict [ key ] , six . string_types ) : alist . append ( adict [ key ] ) else : alist . extend ( adict [ key ] )
add a value from a dictionary to a list parameters adict : dictionary key : hashable alist : list list where value should be added .