from datetime import datetime


def date_parser(items):
    """ datetime parser to help load smp files

    Parameters
    ----------
    items : iterable
        something or somethings to try to parse into datetimes

    Returns
    -------
    dt : iterable
        the cast datetime things
    """
    try:
        dt = datetime.strptime(items,"%d/%m/%Y %H:%M:%S")
    except Exception as e:
        try:
            dt = datetime.strptime(items,"%m/%d/%Y %H:%M:%S")
        except Exception as ee:
            raise Exception("error parsing datetime string" +\
                            " {0}: \n{1}\n{2}".format(str(items),str(e),str(ee)))
    return dt