<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def disk_set(device, flag, state):
    '''
    Changes a flag on selected device.

    A flag can be either "on" or "off" (make sure to use proper
    quoting, see :ref:`YAML Idiosyncrasies
    <yaml-idiosyncrasies>`). Some or all of these flags will be
    available, depending on what disk label you are using.

    Valid flags are:
      * cylinder_alignment
      * pmbr_boot
      * implicit_partition_table

    CLI Example:

    .. code-block:: bash

        salt '*' partition.disk_set /dev/sda pmbr_boot '"on"'
    '''
    _validate_device(device)

    if flag not in VALID_DISK_FLAGS:
        raise CommandExecutionError('Invalid flag passed to partition.disk_set')

    if state not in set(['on', 'off']):
        raise CommandExecutionError('Invalid state passed to partition.disk_set')

    cmd = ['parted', '-m', '-s', device, 'disk_set', flag, state]
    out = __salt__['cmd.run'](cmd).splitlines()
    return out