<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_option(self, block, name, *values):
 """ Adds an option to the AST, either as a non-block option or for an existing block. `block` Block name. Set to ``None`` for non-block option. `name` Option name. `*values` String values for the option. * Raises a ``ValueError`` exception if `values` is empty, `name` is invalid, or `block` doesn't exist. """


        if not self.RE_NAME.match(name):
            raise ValueError(u"Invalid option name '{0}'"
                             .format(common.from_utf8(name)))

        if not values:
            raise ValueError(u"Must provide a value")
        else:
            values = list(values)

        if block:
            # block doesn't exist
            if not block in self._block_map:
                raise ValueError(u"Block '{0}' does not exist"
                                 .format(common.from_utf8(block)))

            # lookup block index and append
            block_idx = self._block_map[block]

            # 0: block name, 1: option_list
            self._ast[2][block_idx][1].append([name, values])

        else:
            # non-block option
            self._ast[1].append([name, values])