@line_magic<EOL><INDENT>def psearch(self, parameter_s='<STR_LIT>'):<DEDENT>
try:<EOL><INDENT>parameter_s.encode('<STR_LIT:ascii>')<EOL><DEDENT>except UnicodeEncodeError:<EOL><INDENT>print('<STR_LIT>')<EOL>return<EOL><DEDENT>def_search = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>opts,args = self.parse_options(parameter_s,'<STR_LIT>',list_all=True)<EOL>opt = opts.get<EOL>shell = self.shell<EOL>psearch = shell.inspector.psearch<EOL>if '<STR_LIT:i>' in opts:<EOL><INDENT>ignore_case = True<EOL><DEDENT>elif '<STR_LIT:c>' in opts:<EOL><INDENT>ignore_case = False<EOL><DEDENT>else:<EOL><INDENT>ignore_case = not shell.wildcards_case_sensitive<EOL><DEDENT>def_search.extend(opt('<STR_LIT:s>',[]))<EOL>ns_exclude = ns_exclude=opt('<STR_LIT:e>',[])<EOL>ns_search = [nm for nm in def_search if nm not in ns_exclude]<EOL>try:<EOL><INDENT>psearch(args,shell.ns_table,ns_search,<EOL>show_all=opt('<STR_LIT:a>'),ignore_case=ignore_case)<EOL><DEDENT>except:<EOL><INDENT>shell.showtraceback()<EOL><DEDENT>
Search for object in namespaces by wildcard.

        %psearch [options] PATTERN [OBJECT TYPE]

        Note: ? can be used as a synonym for %psearch, at the beginning or at
        the end: both a*? and ?a* are equivalent to '%psearch a*'.  Still, the
        rest of the command line must be unchanged (options come first), so
        for example the following forms are equivalent

        %psearch -i a* function
        -i a* function?
        ?-i a* function

        Arguments:

          PATTERN

          where PATTERN is a string containing * as a wildcard similar to its
          use in a shell.  The pattern is matched in all namespaces on the
          search path. By default objects starting with a single _ are not
          matched, many IPython generated objects have a single
          underscore. The default is case insensitive matching. Matching is
          also done on the attributes of objects and not only on the objects
          in a module.

          [OBJECT TYPE]

          Is the name of a python type from the types module. The name is
          given in lowercase without the ending type, ex. StringType is
          written string. By adding a type here only objects matching the
          given type are matched. Using all here makes the pattern match all
          types (this is the default).

        Options:

          -a: makes the pattern match even objects whose names start with a
          single underscore.  These names are normally omitted from the
          search.

          -i/-c: make the pattern case insensitive/sensitive.  If neither of
          these options are given, the default is read from your configuration
          file, with the option ``InteractiveShell.wildcards_case_sensitive``.
          If this option is not specified in your configuration file, IPython's
          internal default is to do a case sensitive search.

          -e/-s NAMESPACE: exclude/search a given namespace.  The pattern you
          specify can be searched in any of the following namespaces:
          'builtin', 'user', 'user_global','internal', 'alias', where
          'builtin' and 'user' are the search defaults.  Note that you should
          not use quotes when specifying namespaces.

          'Builtin' contains the python module builtin, 'user' contains all
          user data, 'alias' only contain the shell aliases and no python
          objects, 'internal' contains objects used by IPython.  The
          'user_global' namespace is only used by embedded IPython instances,
          and it contains module-level globals.  You can add namespaces to the
          search with -s or exclude them with -e (these options can be given
          more than once).

        Examples
        --------
        ::

          %psearch a*            -> objects beginning with an a
          %psearch -e builtin a* -> objects NOT in the builtin space starting in a
          %psearch a* function   -> all functions beginning with an a
          %psearch re.e*         -> objects beginning with an e in module re
          %psearch r*.e*         -> objects that start with e in modules starting in r
          %psearch r*.* string   -> all strings in modules beginning with r

        Case sensitive search::

          %psearch -c a*         list all object beginning with lower case a

        Show objects beginning with a single _::

          %psearch -a _*         list objects beginning with a single underscore