def __set_aperture(ap_in):
    """

    Make sure that aperture dictionary has correct format.

    Parameters
    ----------
    ap_in: dict
        Aperture as defined by user.

    Returns
    -------
    ap_out: dict
        Correctly formated and complete aperture dictionary

    """
    sides = ['top', 'right', 'bottom', 'left']
    ap_out = {}
    for side in sides:
        if ap_in and side in ap_in:
            ap_out[side] = ap_in[side]
        else:
            ap_out[side] = 0
    return ap_out
