from datetime import datetime


def parseTimePeriod(tp):
    """
    Parse a time period specification from the meeting detail page
    Input is a unicode string such as: PM2\xa0Thu, 12-Mar-201515:50\xa0-\xa018:10\n
    outputs:
        A datetime representing the start date and time in the meeting timezone
        A string representing the start slot name
        A datetime representing the end date and time
        A string representing the end slot name
        
    """
    a = tp.encode('ascii','replace')
    p1 = a.split(',')
    p2 = p1[0].split('?')
    
    startSlot = p2[0]
    if (len(p2) > 2) and (p2[1]=='-'):
        endSlot = p2[2]
    else:
        endSlot = startSlot

    p3 = p1[1].split('?')

    d = p3[0]
    e = p3[2]
    
    startDateTime = datetime.strptime(d.strip(),"%d-%b-%Y%H:%M")  
    endTime = datetime.strptime(e.strip(),"%H:%M")
    endDateTime = datetime(startDateTime.year, startDateTime.month, startDateTime.day, endTime.hour, endTime.minute)

    return startDateTime, startSlot, endDateTime, endSlot