def is_excluded(options, start, end, step, nodeposition):
    """Test if a particular range is excluded.
    :param options: OptionParser result
    :param start: Beginning token in the range to repair (formatted string)
    :param end: Ending token in the range to repair (formatted string)
    :param step: The step we're executing (for logging purposes)
    :param nodeposition: string to indicate which node this particular step is for.
    :returns: 0 if not excluded, 1 if entire step is excluded, 2 if only keyspace is excluded.
    """
    current_node = nodeposition.split('/')[0]
    
    if options.offset and options.offset['node'] == int(current_node) and step < options.offset['step']:
        return 1

    if options.exclude_step and options.exclude_step['node'] == current_node and options.exclude_step['step'] == step:
        if options.exclude_step['keyspace']:
            if options.keyspace and options.keyspace == options.exclude_step['keyspace']:
                return 1
            elif not options.keyspace:
                # No options.keyspace means all keyspaces, but we only want to exclude one keyspace
                return 2
        else:
            return 1
    return 0