BlackBerry has agreed in principle to be bought by a consortium led by Fairfax Financial for $4.7 billion. BlackBerry has…