def _p_to_cp(p):
 ret = _porttree().dbapi.xmatch('match-all', p)
 if ret:
  return portage.cpv_getkey(ret[0])
 return None

def _p_to_cp ( p ) : ret = _porttree ( ) . dbapi . xmatch ( 'match-all' , p ) if ret : return portage . cpv_getkey ( ret [ 0 ] ) return None
convert a package name or a depend atom to category/package format .