<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_namespaces_from_names(name, all_names):
 """Return a generator which yields namespace objects."""

    names = configuration_namespaces.keys() if all_names else [name]
    for name in names:
        yield get_namespace(name)