import re


def file_is_of_type(file_name, extension):
  """
  Return whether a file is of a certain type.

  Args:
    file_name the name of the file to test.
    extension the part of the name after the . which will be checked
              with a regular expression. 

  Returns:
    True if file_name ends with extension.
  """
  type_re = re.compile(r'\.%s' % extension)
  return type_re.search(file_name) != None