def dict2opts(d):
   """
   Turns a dictionary into a list of strings representing command-line
   options. Keys of the dictionary should already be in option format,
   i.e. with leading hyphens. Values are arguments of options. None
   values should be used for options without arguments. Options with
   multiple arguments are not supported.
   """
   result = []
   for k, v in d.items():
       result.append(k)
       if v != None:
           result.append(v)
   return result