def code_for_explicit_attribute_initialization(attributes=[], defaults={},
    defaults_name='_attribute_defaults', object_name='self',
    not_found_value=None):
    """Generate code to initialize an objects attributes

    Parameters
    ----------
    object_name : string , optional
        Name of object to set attributes. default='self'.
    attributes : list of strings
        A list of attribute names to set.
    defaults : dict of string-value pairs
        Dictionary specifying the default value of each attribute.
    defaults_name : string, optional
        If ``None`` then the actual values in `defaults` will be used
        to set attributes.  If not ``None`` then those attributes with
        defaults will be initialized by pointing to a dictionary called
        `defaults_name`.  Default defaults_name='_attribute_defaults',
    not_found_value : optional
        Default value to set attribute to if not found in `defaults`.
        default not_found_value=``None``

    Returns
    -------
    out : string
        Code that can be pasted into an object (usually in the __init__
        methos) to explicitly initialize attributes, so the attributes appear
        in autocomplete.

    See Also
    --------
    initialize_objects_attributes : Similar functionality with no copy paste.

    """
    out = ''
    if defaults_name is None:
        for v in attributes:
            v2 = defaults.get(v, not_found_value)
            if isinstance(v2, str):
                v2 = "'{0}'".format(v2)
            out += '{0} = {1}\n'.format('.'.join([object_name, v]), v2)
    else:
        for v in attributes:
            if v in list(defaults.keys()):
                v2 = not_found_value
                if isinstance(v2, str):
                    v2 = "'{0}'".format(v2)
                out += '{0} = {1}.get({2}, {3})\n'.format('.'.join([
                    object_name, v]), '.'.join([object_name, defaults_name]
                    ), "'{}'".format(v), v2)
            else:
                v2 = not_found_value
                if isinstance(v2, str):
                    v2 = "'{0}'".format(v2)
                out += '{0} = {1}\n'.format('.'.join([object_name, v]), v2)
    return out
