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

def signal(signal=None):
    '''
    Signals Apache Solr to start, stop, or restart. Obviously this is only
    going to work if the minion resides on the solr host. Additionally Solr
    doesn't ship with an init script so one must be created.

    signal : str (None)
        The command to pass to the apache solr init valid values are 'start',
        'stop', and 'restart'

    CLI Example:

    .. code-block:: bash

        salt '*' solr.signal restart
    '''
    valid_signals = ('start', 'stop', 'restart')

    # Give a friendly error message for invalid signals
    # TODO: Fix this logic to be reusable and used by apache.signal
    if signal not in valid_signals:
        msg = valid_signals[:-1] + ('or {0}'.format(valid_signals[-1]),)
        return '{0} is an invalid signal. Try: one of: {1}'.format(
            signal, ', '.join(msg))

    cmd = "{0} {1}".format(__opts__['solr.init_script'], signal)
    __salt__['cmd.run'](cmd, python_shell=False)