<s> """<STR_LIT>""" <EOL> from struct import pack <EOL> from exabgp . protocol . family import AFI <EOL> from exabgp . protocol . family import SAFI <EOL> from exabgp . bgp . message . open . capability . capability import Capability <EOL> @ Capability . register ( ) <EOL> class MultiProtocol ( Capability , list ) : <EOL> ID = Capability . CODE . MULTIPROTOCOL <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' + '<STR_LIT:U+002C>' . join ( [ "<STR_LIT>" % ( str ( afi ) , str ( safi ) ) for ( afi , safi ) in self ] ) + '<STR_LIT:)>' <EOL> def json ( self ) : <EOL> return '<STR_LIT>' % '<STR_LIT:U+002C>' . join ( [ '<STR_LIT>' % ( str ( afi ) , str ( safi ) ) for ( afi , safi ) in self ] ) <EOL> def extract ( self ) : <EOL> rs = [ ] <EOL> for v in self : <EOL> rs . append ( pack ( '<STR_LIT>' , v [ <NUM_LIT:0> ] ) + pack ( '<STR_LIT>' , v [ <NUM_LIT:1> ] ) ) <EOL> return rs <EOL> @ staticmethod <EOL> def unpack_capability ( instance , data , capability = None ) : <EOL> afi = AFI . unpack ( data [ : <NUM_LIT:2> ] ) <EOL> safi = SAFI . unpack ( data [ <NUM_LIT:3> ] ) <EOL> instance . append ( ( afi , safi ) ) <EOL> return instance </s>
