code: def start_of_day(val):
      
      if type(val) == date:
          val = datetime.fromordinal(val.toordinal())
      return val.replace(hour=0, minute=0, second=0, microsecond=0)
docs: Return a new datetime.datetime object with values that represent
      a start of a day.
      :param val: Date to ...
      :type val: datetime.datetime | datetime.date
      :rtype: datetime.datetime