code: def list_tasks(target=None):
      
      from os import getcwd, chdir
      from glob import glob
      original = getcwd()
      if target is None:# pragma: no cover
          target = _dbdir()
          
      chdir(target)
      result = {}
      for filename in glob("*.*.json"):
          project, task = filename.split('.')[0:2]
          if project not in result:
              result[project] = []
          result[project].append(task)
  
      #Set the working directory back to what it was.
      chdir(original)
          
      return result
docs: Returns a list of all the projects and tasks available in the `acorn`
      database directory.
  
      Args:
          target (str): directory to list the projects for. Defaults to the configured
            database directory.    
  
      Returns:
          dict: keys are project names; values are lists of tasks associated with the
            project.