code: def _truncate_wildcard_from_date(date_value):
      
      if ' ' in date_value:
          date_parts = date_value.split(' ')
      elif '-' in date_value:
          date_parts = date_value.split('-')
      else:
          # Either unsupported separators or wildcard in year, e.g. '201*'.
          raise ValueError("Erroneous date value: %s.", date_value)
  
      if GenericValue.WILDCARD_TOKEN in date_parts[-1]:
          del date_parts[-1]
  
      return '-'.join(date_parts)
docs: Truncate wildcard from date parts.
  
      Returns:
          (str) The truncated date.
  
      Raises:
          ValueError, on either unsupported date separator (currently only ' ' and '-' are supported), or if there's a
          wildcard in the year.
  
      Notes:
          Either whole date part is wildcard, in which we ignore it and do a range query on the
          remaining parts, or some numbers are wildcards, where again, we ignore this part.