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

def attach_(dev=None):
    '''
    Attach a backing devices to a cache set
    If no dev is given, all backing devices will be attached.

    CLI example:

    .. code-block:: bash

        salt '*' bcache.attach sdc
        salt '*' bcache.attach /dev/bcache1


    :return: bool or None if nuttin' happened
    '''
    cache = uuid()
    if not cache:
        log.error('No cache to attach %s to', dev)
        return False

    if dev is None:
        res = {}
        for dev, data in status(alldevs=True).items():
            if 'cache' in data:
                res[dev] = attach_(dev)

        return res if res else None

    bcache = uuid(dev)
    if bcache:
        if bcache == cache:
            log.info('%s is already attached to bcache %s, doing nothing', dev, cache)
            return None
        elif not detach(dev):
            return False

    log.debug('Attaching %s to bcache %s', dev, cache)

    if not _bcsys(dev, 'attach', cache,
                  'error', 'Error attaching {0} to bcache {1}'.format(dev, cache)):
        return False

    return _wait(lambda: uuid(dev) == cache,
                 'error', '{0} received attach to bcache {1}, but did not comply'.format(dev, cache))