'Return a list of UserRPCs, expanding MultiRpcs in the argument list.
For example: given 4 UserRPCs rpc1 through rpc4,
flatten(rpc1, MultiRpc([rpc2, rpc3], rpc4)
returns [rpc1, rpc2, rpc3, rpc4].
Args:
rpcs: A list of UserRPC and MultiRpc objects.
Returns:
A list of UserRPC objects.'

@classmethod
def flatten(cls, rpcs):

    flat = []
    for rpc in rpcs:
        if isinstance(rpc, MultiRpc):
            flat.extend(rpc.__rpcs)
        else:
            if (not isinstance(rpc, apiproxy_stub_map.UserRPC)):
                raise datastore_errors.BadArgumentError(('Expected    a    list    of    UserRPC    object    (%r)' % (rpc,)))
            flat.append(rpc)
    return flat
