def read_file(location, chomp=True):
  """
  Read the specified file and return the contents. Optionally
  the file content could be subjected to a chomp operation
  before returning.

  Args:
    location  Location of the file that needs to be read
    chomp     True if the file content needs to be chomped
              prior to returning. This is an optional parameter
              and defaults to True.

  Raises:
    IOError   If the specified file does not exist
  """
  with open(location) as file_handle:
    contents = file_handle.read()
  if chomp:
    return contents.rstrip('\n')
  else:
    return contents