def best_search_result(conda_target, conda_context=None, channels_override=None):
 conda_context = _ensure_conda_context(conda_context)
 if (not channels_override):
  conda_context.ensure_channels_configured()
 search_cmd = [conda_context.conda_exec, 'search', '--full-name', '--json']
 if channels_override:
  search_cmd.append('--override-channels')
  for channel in channels_override:
   search_cmd.extend(['--channel', channel])
 search_cmd.append(conda_target.package)
 res = commands.execute(search_cmd)
 hits = json.loads(res).get(conda_target.package, [])
 hits = sorted(hits, key=(lambda hit: LooseVersion(hit['version'])), reverse=True)
 if (len(hits) == 0):
  return (None, None)
 best_result = (hits[0], False)
 for hit in hits:
  if is_search_hit_exact(conda_target, hit):
   best_result = (hit, True)
   break
 return best_result

def best_search_result ( conda_target , conda_context = None , channels_override = None ) : conda_context = _ensure_conda_context ( conda_context ) if ( not channels_override ) : conda_context . ensure_channels_configured ( ) search_cmd = [ conda_context . conda_exec , 'search' , '--full-name' , '--json' ] if channels_override : search_cmd . append ( '--override-channels' ) for channel in channels_override : search_cmd . extend ( [ '--channel' , channel ] ) search_cmd . append ( conda_target . package ) res = commands . execute ( search_cmd ) hits = json . loads ( res ) . get ( conda_target . package , [ ] ) hits = sorted ( hits , key = ( lambda hit : LooseVersion ( hit [ 'version' ] ) ) , reverse = True ) if ( len ( hits ) == 0 ) : return ( None , None ) best_result = ( hits [ 0 ] , False ) for hit in hits : if is_search_hit_exact ( conda_target , hit ) : best_result = ( hit , True ) break return best_result
find best "conda search" result for specified target .