def initialize_objects_attributes(obj, attributes=[], defaults=dict(),
    not_found_value=None):
    """Initialize an objects attributes

    For each attribute, set it to the value found in `defaults` dictionary
    or, if the attribute is not found, set it to `not_found_value`.

    Parameters
    ----------
    obj : object
        Object to set attributes in.
    attributes : list of strings
        A list of attribute names to set.
    defaults : dict of string-value pairs, optional
        Dictionary specifying the default value of each attribute.
        Default defautls=dict() i.e. no explicit default value.
    not_found_value : optional
        Default value to set attribute to if not found in `defaults` dict.
        Default not_found_value=None.



    Notes
    -----
    If using this function to initialize attributes in a class then just
    be aware that the attributes will not be available for auto-complete
    until an instance of the class is created.  This can be annoying when
    coding the class itself because typing 'self.' will not have any
    autocomplete options.  To work around this use a temporary explicit
    assignment e.g. 'self.a = 6' and then later comment it out when coding of
    the class is finsihed.

    See Also
    --------
    code_for_explicit_attribute_initialization : Use for temporary explicit
        attribute initialization to facilitate auto-complete, then comment
        out when done.

    """
    for v in attributes:
        obj.__setattr__(v, defaults.get(v, not_found_value))
    return
