• Time Converter (24h to 12h) - invisible statement

Question related to mission Time Converter (24h to 12h)

 
    from datetime import datetime

def time_converter(time):
    am = ' a.m.'
    pm = ' p.m.'
    if "AM" in time:
        return time + '{}'.format(am)
    else:
        return time + '{}'.format(pm)
    # not executing and i don't understand, why
    parsed_string = datetime.strptime(time, "%H:%M")
    formatted_to_twelve = parsed_string.strftime("%I:%M")    
    if formatted_to_twelve.startswith("0"):
        return formatted_to_twelve[len(formatted_to_twelve[0]):]
    else:
        return formatted_to_twelve

How to make the second "if" statement visible, to be executed? For now, only the first part of this function is executing, and I cannot get, why.