def _format_use_masks(use_masks, mask, dapmap, default_masks):
    """Convert input format of ``use_masks`` into list of strings.

    Parameters:
        use_masks (bool, list):
            If ``True``, use the ``default_masks``. If ``False``, do
            not use any masks. Otherwise, use a list of bitnames.
        mask (array):
            Mask values.
        dapmap (marvin.tools.quantities.Map):
            Marvin Map object.
        default_masks:
            Default bitmasks to use if ``use_mask == True``.

    Returns:
        list:
            Names of bitmasks to apply.
    """
    if (mask is None) or (use_masks is False):
        return []
    elif isinstance(use_masks, bool):
        return default_masks if dapmap is not None else []
    else:
        return use_masks