<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_validate(ctx, param, value):
 """ Validate the -w option. Purpose: Validates the `-w`|`--write` option. Two arguments are expected. | The first is the mode, which must be in ['s', 'single', 'm', | 'multiple']. The mode determins if we're writing to one file for | all device output, or to a separate file for each device being | handled. | | The second expected argument is the filepath of the desired | output file. This will automatically be prepended with the IP or | hostname of the device if we're writing to multiple files. @param ctx: The click context paramter, for receiving the object dictionary | being manipulated by other previous functions. Needed by any | function with the @click.pass_context decorator. Callback | functions such as this one receive this automatically. @type ctx: click.Context @param param: param is passed into a validation callback function by click. | We do not use it. @type param: None @param value: The value that the user supplied for the write option. @type value: str @returns: The value that the user supplied, if it passed validation. | Otherwise, raises click.BadParameter @rtype: str """

    if value != ("default", "default"):
        try:
            mode, dest_file = (value[0], value[1])
        except IndexError:
            raise click.BadParameter('Expecting two arguments, one for how to '
                                     'output (s, single, m, multiple), and '
                                     'the second is a filepath where to put'
                                     ' the output.')
        if mode.lower() not in ['s', 'single', 'm', 'multiple']:
            raise click.BadParameter('The first argument of the -w/--write '
                                     'option must specifies whether to write'
                                     ' to one file per device, or all device'
                                     ' output to a single file. Valid options'
                                     ' are "s", "single", "m", and "multiple"')
        # we've passed the checks, so set the 'out' context variable to our
        # tuple of the mode, and the destination file.
        ctx.obj['out'] = (mode.lower(), dest_file)
    else:  # they didn't use -w, so set the context variable accordingly.
        ctx.obj['out'] = None