def _find_output(self, layer):
if layer is None:<EOL><INDENT>layer = len(self.layers) // <NUM_LIT:2><EOL><DEDENT>if isinstance(layer, int):<EOL><INDENT>layer = self.layers[layer]<EOL><DEDENT>if isinstance(layer, util.basestring):<EOL><INDENT>try:<EOL><INDENT>layer = [l for l in self.layers if l.name == layer][<NUM_LIT:0>]<EOL><DEDENT>except IndexError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if isinstance(layer, layers.Layer):<EOL><INDENT>layer = layer.output_name<EOL><DEDENT>return layer<EOL>
Find a layer output name for the given layer specifier.

        Parameters
        ----------
        layer : None, int, str, or :class:`theanets.layers.Layer`
            A layer specification. If this is None, the "middle" layer in the
            network will be used (i.e., the layer at the middle index in the
            list of network layers). If this is an integer, the corresponding
            layer in the network's layer list will be used. If this is a string,
            the layer with the corresponding name will be returned.

        Returns
        -------
        name : str
            The fully-scoped output name for the desired layer.