from datetime import datetime


def human_readable_time_from_epoch_time(epoch_time: int, utc_time: bool = False):
    """
    Divides the epoch time by 1e6 since the epoch format has 6 trailing zeroes
    Since incidents need the time in utc format (ends in 'Z') but the SQL syntax cannot parse a UTC formatted date well
    it is parameterized
    Args:
        utc_time: A boolean that states weather to add the 'Z' at the end of the date string
        epoch_time: Epoch time as it is in the raw_content
    Returns:
        human readable time in the format of '1970-01-01T02:00:00'
    """
    result = datetime.fromtimestamp(epoch_time / 1e6).isoformat() if epoch_time else None
    if result:
        result += 'Z' if utc_time else ''
    return result