def choose_step(args: argparse.Namespace, tool: Process, loading_context: LoadingContext) -> Optional[Process]:
    'Walk the given Workflow and extract just args.single_step.'
    if (loading_context.loader is None):
        raise Exception('loading_context.loader cannot be None')
    if isinstance(tool, Workflow):
        url = urllib.parse.urlparse(tool.tool['id'])
        if url.fragment:
            step_id = ((tool.tool['id'] + '/') + args.single_step)
        else:
            step_id = loading_context.loader.fetcher.urljoin(tool.tool['id'], ('#' + args.single_step))
        extracted = get_step(tool, step_id, loading_context)
    else:
        _logger.error('Can only use --single-step on Workflows')
        return None
    if isinstance(loading_context.loader.idx, MutableMapping):
        loading_context.loader.idx[extracted['id']] = cast(Union[(CommentedMap, CommentedSeq, str, None)], cmap(extracted))
        tool = make_tool(extracted['id'], loading_context)
    else:
        raise Exception('Missing loading_context.loader.idx!')
    return tool
Walk the given Workflow and extract just args.single_step.
def choose_step(args: argparse.Namespace, tool: Process, loading_context: LoadingContext) -> Optional[Process]:
    
    if (loading_context.loader is None):
        raise Exception('loading_context.loader cannot be None')
    if isinstance(tool, Workflow):
        url = urllib.parse.urlparse(tool.tool['id'])
        if url.fragment:
            step_id = ((tool.tool['id'] + '/') + args.single_step)
        else:
            step_id = loading_context.loader.fetcher.urljoin(tool.tool['id'], ('#' + args.single_step))
        extracted = get_step(tool, step_id, loading_context)
    else:
        _logger.error('Can only use --single-step on Workflows')
        return None
    if isinstance(loading_context.loader.idx, MutableMapping):
        loading_context.loader.idx[extracted['id']] = cast(Union[(CommentedMap, CommentedSeq, str, None)], cmap(extracted))
        tool = make_tool(extracted['id'], loading_context)
    else:
        raise Exception('Missing loading_context.loader.idx!')
    return tool