code: def _print_tasks(env, tasks, mark_active=False):
      
  
      if env.task.active and mark_active:
          active_task = env.task.name
      else:
          active_task = None
  
      for task, options, blocks in tasks:
          # print heading
          invalid = False
  
          if task == active_task:
              method = 'success'
          else:
              if options is None and blocks is None:
                  method = 'error'
                  invalid = True
  
              else:
                  method = 'write'
  
          opts = list(options or [])
          blks = list(blocks or [])
  
          write = getattr(env.io, method)
          write('~' * 80)
          write(' ' + task)
          write('~' * 80)
          env.io.write('')
  
          # non-block options
          if opts:
              for opt, values in opts:
                  env.io.write('    {0}: {1}'.format(opt,
                               ', '.join(str(v) for v in values)))
              env.io.write('')
  
          # block options
          if blks:
              had_options = False
  
              for block, options in blks:
                  if options:
                      had_options = True
                      env.io.write('    {{ {0} }}'.format(block))
  
                      for opt, values in options:
                          env.io.write('        {0}: {1}'.format(opt,
                                       ', '.join(str(v) for v in values)))
                      env.io.write('')
  
              if not had_options:
                  blks = None
  
          if not opts and not blks:
              if invalid:
                  env.io.write('  Invalid task.')
              else:
                  env.io.write('  Empty task.')
              env.io.write('')
docs: Prints task information using io stream.
  
          `env`
              ``Environment`` object.
          `tasks`
              List of tuples (task_name, options, block_options).
          `mark_active`
              Set to ``True`` to mark active task.