def METHOD_NAME(dep):  # Return the key
    key, val = parse_key_target(dep)
    if key == '':
        # key only matches empty string if ':' present
        _, _, bundle, subpath = parse_target_spec(val)
        key = subpath if subpath is not None else bundle
    elif key is None:
        # key only returns None if ':' not present in original spec
        key = val2key[val] if val in val2key else 'b' + str(len(target_spec) + 1)
    if val not in val2key:
        val2key[val] = key
    if key in key2val:
        if key2val[key] != val:
            raise UsageError(
                'key %s exists with multiple values: %s and %s' % (key, key2val[key], val)
            )
    else:
        key2val[key] = val
        target_spec.append(key + ':' + val)
    return key