[docs]defget_datetime(human_datetime:str,option:HumanDatetimeOptions|int,time_formats=["%H:%M"],date_formats=["%d/%m/%Y","%Y/%m/%d"],datetime_formats=["%d/%m/%Y %H:%M","%Y/%m/%d %H:%M","%d.%m.%Y %H:%M","%Y.%m.%d %H:%M"])->datetime|None:""" A Goldy Bot utils function that can read human time and date and convert them to a datetime object. Returns None if the human datetime string can't be recognized. """ifisinstance(option,int):option=HumanDatetimeOptions(option)ifoption==HumanDatetimeOptions.TIME:returndateparser.parse(human_datetime,date_formats=time_formats)elifoption==HumanDatetimeOptions.DATE:returndateparser.parse(human_datetime,date_formats=date_formats)elifoption==HumanDatetimeOptions.BOTH:returndateparser.parse(human_datetime,date_formats=datetime_formats)