def copy_obj_attributes(obj_from, obj_to, attributes_l=None):
    """
    Copy attributes of class instance (object) "obj_from" to class instance
    (object) "obj_to". The two objects are assumed to be instances of the
    same class.

    Args:
        obj_from: class instance (object) to copy from
        obj_to: class instance (object) to copy to
        attributes_l: list of attributes to be copied. If none, a
        blind copy is performed, where all attributes of obj_from are copied
        to obj_to.

    Returns:
        obj_to
    """

    assert isinstance(obj_from, obj_to.__class__)

    if attributes_l is None:
        # blind copy: copy all attributes of obj_from
        obj_to.__dict__.update(obj_from.__dict__)
    else:
        # copy selected attributes only
        for attr in attributes_l:
            if hasattr(obj_from, attr):
                value = getattr(obj_from, attr)
                setattr(obj_to, attr, value)

    return obj_to