def hhmmss_to_seconds(hhmmss):
    """
    Translates HHMMSS or HHMM formatted time into seconds.

    Args:
        hhmmss (str): String in HHMMSS or HHMM format

    Returns:
        seconds (int): Converted seconds
    """
    hhmmss_split = hhmmss.split(":")
    try:
        seconds = (int(hhmmss_split[0]) * 60 * 60) + (int(hhmmss_split[1]) * 60) + int(hhmmss_split[2])
    except IndexError:  # If IndexError then it would be HHMM instead of HHMMSS so run below code \/
        seconds = (int(hhmmss_split[0]) * 60 * 60) + (int(hhmmss_split[1]) * 60)
    return seconds