import re


def FormatTime(time):
    """Returns the time variable back in ##:## format

    Args:
      time: a string representing the iqamah time

    Returns: a string containing the iqamah time in ##:## format
    """

    # if the time input is in a format where it contains integers
    # then proceed forward otherwise return None
    if re.match(r'(\d+)', time):
        # strip the time variable from anything added to it
        # example: 10:00 PM becomes 1000 and 5 AM becomes 5
        time = ''.join(re.findall(r'(\d+)', time))
        # if time length is more than 2 characters then add a : after
        # the second character from the right
        # example: 1000 becomes 10:00 and 5 stays 5
        if len(time) > 2:
            return time[:-2] + ':' + time[-2:]
        return time + ':00'