def _find_option_with_arg(argv, short_opts=None, long_opts=None):
 for (i, arg) in enumerate(argv):
  if arg.startswith(u'-'):
   if (long_opts and arg.startswith(u'--')):
    (name, sep, val) = arg.partition(u'=')
    if (name in long_opts):
     return (val if sep else argv[(i + 1)])
   if (short_opts and (arg in short_opts)):
    return argv[(i + 1)]
 raise KeyError(u'|'.join((short_opts or ([] + long_opts) or [])))

def _find_option_with_arg ( argv , short_opts = None , long_opts = None ) : for ( i , arg ) in enumerate ( argv ) : if arg . startswith ( u'-' ) : if ( long_opts and arg . startswith ( u'--' ) ) : ( name , sep , val ) = arg . partition ( u'=' ) if ( name in long_opts ) : return ( val if sep else argv [ ( i + 1 ) ] ) if ( short_opts and ( arg in short_opts ) ) : return argv [ ( i + 1 ) ] raise KeyError ( u'|' . join ( ( short_opts or ( [ ] + long_opts ) or [ ] ) ) )
search argv for options specifying short and longopt alternatives .