code: def python_date_format(self, long_format=None, time_only=False):
          
          # get msgid
          msgid = long_format and 'date_format_long' or 'date_format_short'
          if time_only:
              msgid = 'time_format'
          # get the formatstring
          formatstring = translate(msgid, domain="senaite.core",
                                   context=self.request)
  
          if formatstring is None or formatstring.startswith(
                  'date_') or formatstring.startswith('time_'):
              self.logger.error("bika/%s/%s could not be translated" %
                                (self.request.get('LANGUAGE'), msgid))
              # msg catalog was not able to translate this msgids
              # use default setting
              properties = getToolByName(self.context,
                                         'portal_properties').site_properties
              if long_format:
                  format = properties.localLongTimeFormat
              else:
                  if time_only:
                      format = properties.localTimeOnlyFormat
                  else:
                      format = properties.localTimeFormat
              return format
          return formatstring.replace(r"${", '%').replace('}', '')
docs: This convert bika domain date format msgstrs to Python
          strftime format strings, by the same rules as ulocalized_time.
          XXX i18nl10n.py may change, and that is where this code is taken from.