from functools import reduce
import operator


def get_status_float(status_info, *keys, default_value='N/A', precision=4,
                     format='f', scale=1.0, include_plus_sign=False):
    """
    Get the value of a dictionary key.

    Format the value with the precision requested if it is a float value.

    Parameters
    ----------
    status_info : dict
        Dictionary to look through.
    keys : list
        List of keys to look through with nested dictionarie.
    default_value : str, optional
        A default value to return if the item value was not found.
    precision : int, optional
        Precision requested for the float values. Defaults to 4.
    format : str, optional
        Format specifier to use for the floating point value. Defaults to 'f'.
    scale : float, optional
        Scale to apply to value prior to formatting.
    include_plus_sign : bool, optional
        Include a plus sign before a positive value for text alignment
        purposes. Defaults to False.

    Returns
    -------
    value : dictionary item value, or `N/A`
        Value of the last key in the `keys` list formated with precision.
    """
    try:
        value = reduce(operator.getitem, keys, status_info)
        if isinstance(value, (int, float)):
            value = float(value) * scale
            if include_plus_sign:
                fmt = '{:+.%d%s}' % (precision, format)
            else:
                fmt = '{:.%d%s}' % (precision, format)
            return fmt.format(value)
        return value
    except KeyError:
        return default_value