<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse(self, argument):
 """Determines validity of argument and returns the correct element of enum. Args: argument: str or Enum class member, the supplied flag value. Returns: The first matching Enum class member in Enum class. Raises: ValueError: Raised when argument didn't match anything in enum. """

    if isinstance(argument, self.enum_class):
      return argument
    if argument not in self.enum_class.__members__:
      raise ValueError('value should be one of <%s>' %
                       '|'.join(self.enum_class.__members__.keys()))
    else:
      return self.enum_class[argument]