<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def xldate_as_datetime(xldate, datemode=0, option="to_datetime"):
 """Converts a xls date stamp to a more sensible format. Args: xldate (str):
 date stamp in Excel format. datemode (int):
 0 for 1900-based, 1 for 1904-based. option (str):
 option in ("to_datetime", "to_float", "to_string"), return value Returns: datetime (datetime object, float, or string). """


    # This does not work for numpy-arrays

    if option == "to_float":
        d = (xldate - 25589) * 86400.0
    else:
        try:
            d = datetime.datetime(1899, 12, 30) + \
                datetime.timedelta(days=xldate + 1462 * datemode)
            # date_format = "%Y-%m-%d %H:%M:%S:%f" # with microseconds,
            # excel cannot cope with this!
            if option == "to_string":
                date_format = "%Y-%m-%d %H:%M:%S"  # without microseconds
                d = d.strftime(date_format)
        except TypeError:
            logging.info(f'The date is not of correct type [{xldate}]')
            d = xldate
    return d