code: function peerInfoFromMa (peer) {
      let p
      // PeerInfo
      if (PeerInfo.isPeerInfo(peer)) {
        p = peer
        // Multiaddr instance (not string)
      } else if (multiaddr.isMultiaddr(peer)) {
        const peerIdB58Str = peer.getPeerId()
        try {
          p = swarm._peerBook.get(peerIdB58Str)
        } catch (err) {
          p = new PeerInfo(PeerId.createFromB58String(peerIdB58Str))
        }
        p.multiaddrs.add(peer)
        // PeerId
      } else if (PeerId.isPeerId(peer)) {
        const peerIdB58Str = peer.toB58String()
        p = swarm._peerBook.has(peerIdB58Str) ? swarm._peerBook.get(peerIdB58Str) : peer
      }
  
      return p
    }
docs: Helper to make a peer info from a multiaddrs
  
  @param {Multiaddr|PeerInfo|PeerId} ma
  @param {Swarm} swarm
  @return {PeerInfo}
  @private
   TODO: this is ripped off of libp2p, should probably be a generally available util function