from pathlib import Path
import typing


def is_non_empty_dir(expected_dir: Path) -> typing.List[str]:
  """Assert that directory exists, and that it's not empty.

  Returns:
    A list of errors found, or empty if successful.
  """
  errs = []
  if expected_dir.is_dir():
    for child in expected_dir.iterdir():
      if child.is_file() or (
          child.is_dir() and len(is_non_empty_dir(child)) == 0):
        return errs
    errs.append('Directory is empty: {}'.format(expected_dir))
  else:
    errs.append('Directory not found: {}'.format(expected_dir))
  return errs