Draws axes corresponding to the scales of a given mark.

    It also returns a dictionary of drawn axes. If the mark is not provided,
    the last drawn mark is used.

    Parameters
    ----------
    mark: Mark or None (default: None)
        The mark to inspect to create axes. If None, the last mark drawn is
        used instead.
    options: dict (default: {})
        Options for the axes to be created. If a scale labeled 'x' is required
        for that mark, options['x'] contains optional keyword arguments for the
        constructor of the corresponding axis type.

def axes(mark=None, options={}, **kwargs):
    """Draws axes corresponding to the scales of a given mark.

    It also returns a dictionary of drawn axes. If the mark is not provided,
    the last drawn mark is used.

    Parameters
    ----------
    mark: Mark or None (default: None)
        The mark to inspect to create axes. If None, the last mark drawn is
        used instead.
    options: dict (default: {})
        Options for the axes to be created. If a scale labeled 'x' is required
        for that mark, options['x'] contains optional keyword arguments for the
        constructor of the corresponding axis type.
    """
    if mark is None:
        mark = _context['last_mark']
    if mark is None:
        return {}
    fig = kwargs.get('figure', current_figure())
    scales = mark.scales
    fig_axes = [axis for axis in fig.axes]
    axes = {}
    for name in scales:
        if name not in mark.class_trait_names(scaled=True):
            # The scale is not needed.
            continue
        scale_metadata = mark.scales_metadata.get(name, {})
        dimension = scale_metadata.get('dimension', scales[name])
        axis_args = dict(scale_metadata,
                         **(options.get(name, {})))

        axis = _fetch_axis(fig, dimension, scales[name])
        if axis is not None:
            # For this figure, an axis exists for the scale in the given
            # dimension. Apply the properties and return back the object.
            _apply_properties(axis, options.get(name, {}))
            axes[name] = axis
            continue

        # An axis must be created. We fetch the type from the registry
        # the key being provided in the scaled attribute decoration
        key = mark.class_traits()[name].get_metadata('atype')
        if(key is not None):
            axis_type = Axis.axis_types[key]
            axis = axis_type(scale=scales[name], **axis_args)
            axes[name] = axis
            fig_axes.append(axis)
            # Update the axis registry of the figure once the axis is added
            _update_fig_axis_registry(fig, dimension, scales[name], axis)
    fig.axes = fig_axes
    return axes