from datetime import datetime
from dateutil import tz
import random
import string


def generate_output_directory_string(working_path: str) -> str:
    """ Generates output folder string in format ``YYMMDD_HHMMSS_ABC``
    that will be appended at the end of working dir.

    The handling of the timestamp can be checked in
    https://docs.python.org/3.6/library/datetime.html#strftime-strptime-behavior.

    Args:
        working_path (str): Working path of the project where the results will be saved.

    Returns:
        str: unique folder in the working path were results will be saved.

    """
    # Generate output folders with timestamp
    timestamp = datetime.now(tz.tzlocal()).strftime('%y%m%d_%H%M%S')
    job_id = ''.join(random.choices(string.ascii_uppercase + string.digits, k=3))

    return f'{working_path}/{timestamp}_{job_id}'