import re


def generate_id(title, published_on=None):
  """Generates a report id given the report title and published date.

  This generally tries to be clever and uses the first letter of each name of
  the title, then the month date and year of the report as the ID.
  """
  words = title.split()
  letters = [word[0] for word in words if re.match(r'\w', word[0])]
  slug = ''.join(letters).upper()
  if published_on:
    return '%s-%s' % (slug[:16], published_on.strftime('%Y-%m-%d'))
  else:
    return slug