from pathlib import Path


def get_ega_xml_dir(which_box):
  """Returns the canonical path to the cache for `which_box`.

  Parameter `which_box` should be an EGA or ENA login, e.g. "ega-box-000" or "Webin-00000"
  """

  box_dir = Path.home() / 'ega-xml' / which_box

  if ( not box_dir.is_dir() ):
    raise FileNotFoundError("couldn't find XML dump directory for box: '%s'" % box_dir).with_traceback(None)

  return box_dir