def coerce_to_list(val):
 if val:
  if (not isinstance(val, (list, tuple))):
   val = [val]
 else:
  val = []
 return val

def coerce_to_list ( val ) : if val : if ( not isinstance ( val , ( list , tuple ) ) ) : val = [ val ] else : val = [ ] return val
for parameters that can take either a single string or a list of strings .