def get_twin(ax, axis, tickdir='in', majlen=4, minlen=2):
    """
    Construct the "twin" axes of the provided Axes object.

    Args:
        ax (`matplotlib.axes.Axes`_):
            Original Axes object.
        axis (:obj:`str`):
            The axis to *mirror*. E.g., to get the right ordinate that
            mirrors the left ordinate, use ``axis='y'``.
        tickdir (:obj:`str`, optional):
            Direction for the axis tick marks.
        majlen (:obj:`int`, optional):
            Length for the major tick marks.
        minlen (:obj:`int`, optional):
            Length for the minor tick marks.

    Returns:
        `matplotlib.axes.Axes`_: Axes object selecting the requested axis
        twin.
    """
    axt = ax.twinx() if axis == 'y' else ax.twiny()
    axt.minorticks_on()
    axt.tick_params(which='major', length=majlen, direction=tickdir)
    axt.tick_params(which='minor', length=minlen, direction=tickdir)
    return axt