def _magnitude_to_marker_size(v_mag):
    """Calculate the size of a matplotlib plot marker representing an object with
    a given visual megnitude.

    A third-degree polynomial was fit to a few hand-curated examples of
    marker sizes for magnitudes, as follows:

    >>> x = np.array([-1.44, -0.5, 0., 1., 2., 3., 4., 5.])
    >>> y = np.array([120., 90., 60., 30., 15., 11., 6., 1.])
    >>> coeffs = np.polyfit(x, y, 3)

    This function is valid over the range -2.0 < v <= 6.0; v < -2.0 returns
    size = 160. and v > 6.0 returns size = 1.

    Args:
        v_mag: A float representing the visual magnitude of a sky object.

    Returns:
        A float to be used as the size of a marker depicting the sky object in a
            matplotlib.plt scatterplot.
    """

    if v_mag < -2.0:
        size = 160.0
    elif v_mag > 6.0:
        size = 1.0
    else:
        coeffs = [-0.39439046, 6.21313285, -33.09853387, 62.07732768]
        size = coeffs[0] * v_mag**3. + coeffs[1] * v_mag**2. + coeffs[2] * v_mag + coeffs[3]
    return size