from datetime import datetime


def datify(a: list):
    """
    Here I turn a list of strings in datetime format.
    
    :param a: list of strings, an example is ['Mar', '18,', '2019']
    returns date in datetime format
    """
    
    date = ' '.join(a)
    
    # remove commas
    date = date.replace(',', '')
    
    # parse dates
    if len(a) == 3:
        date = datetime.strptime(date, '%b %d %Y')
    elif len(a) == 2:
        date = datetime.strptime(date, '%b %Y')
    else:
        date = datetime.strptime(date, '%Y')
        
    return date