code: def casperjs_command_kwargs():
      
      kwargs = {
          'stdout': subprocess.PIPE,
          'stderr': subprocess.PIPE,
          'universal_newlines': True
      }
      phantom_js_cmd = app_settings['PHANTOMJS_CMD']
      if phantom_js_cmd:
          path = '{0}:{1}'.format(
              os.getenv('PATH', ''), os.path.dirname(phantom_js_cmd)
          )
          kwargs.update({'env': {'PATH': path}})
      return kwargs
docs: will construct kwargs for cmd