<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def unit_defs_from_sheet(sheet, column_names):
 """A generator that parses a worksheet containing UNECE code definitions. Args: sheet: An xldr.sheet object representing a UNECE code worksheet. column_names: A list/tuple with the expected column names corresponding to the unit name, code and suffix in that order. Yields: Lines of Python source code that define OpenHTF Unit objects. """

  seen = set()
  try:
    col_indices = {}
    rows = sheet.get_rows()
    
    # Find the indices for the columns we care about.
    for idx, cell in enumerate(six.next(rows)):
      if cell.value in column_names:
        col_indices[cell.value] = idx

    # loop over all remaining rows and pull out units.
    for row in rows:
      name = row[col_indices[column_names[0]]].value.replace("'", r'\'')
      code = row[col_indices[column_names[1]]].value
      suffix = row[col_indices[column_names[2]]].value.replace("'", r'\'')
      key = unit_key_from_name(name)
      if key in seen:
        continue
      seen.add(key)

      # Split on ' or ' to support the units like '% or pct'
      for suffix in suffix.split(' or '):
        yield "%s = UnitDescriptor('%s', '%s', '''%s''')\n" % (
            key, name, code, suffix)
        yield "ALL_UNITS.append(%s)\n" % key

  except xlrd.XLRDError:
    sys.stdout.write('Unable to process the .xls file.')