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

def beacon(config):
    '''
    Scan for processes and fire events

    Example Config

    .. code-block:: yaml

        beacons:
          ps:
            - processes:
                salt-master: running
                mysql: stopped

    The config above sets up beacons to check that
    processes are running or stopped.
    '''
    ret = []
    procs = []
    for proc in psutil.process_iter():
        _name = proc.name()
        if _name not in procs:
            procs.append(_name)

    _config = {}
    list(map(_config.update, config))

    for process in _config.get('processes', {}):
        ret_dict = {}
        if _config['processes'][process] == 'running':
            if process in procs:
                ret_dict[process] = 'Running'
                ret.append(ret_dict)
        elif _config['processes'][process] == 'stopped':
            if process not in procs:
                ret_dict[process] = 'Stopped'
                ret.append(ret_dict)
        else:
            if process not in procs:
                ret_dict[process] = False
                ret.append(ret_dict)
    return ret