@staticmethod
    def make(versions):
        '''Construct and return a VersionsCell, using default values
        where possible.

        Automatically create and use an appropriate FixedLenCell.Header.

        .. note: A VersionsCell always has len(circ_id_bytes) == 2 for
            backward compatibility (tor-spec, Section 3).

        .. note: oppy can currently only support Link Protocol versions
            3 and 4, so any other versions will be rejected.

        :param list, int versions: Link Protocol versions to indicate support
            for in this VersionsCell
        :returns: :class:`~cell.varlen.VersionsCell`
        '''
        for version in versions:
            if version not in CONN_DEFS.SUPPORTED_LINK_PROTOCOLS:
                msg = "Tried to build a VersionsCell that supports versions "
                msg += "{}, but oppy only supports versions {}."
                msg = msg.format(versions, CONN_DEFS.SUPPORTED_LINK_PROTOCOLS)
                raise BadPayloadData(msg)

        h = VarLenCell.Header(circ_id=0, cmd=DEF.VERSIONS_CMD,
                              payload_len=len(versions) * 2,
                              link_version=3)

        return VersionsCell(h, versions)
dataset/ETHPy150Open nskinkel/oppy/oppy/cell/varlen.py/VersionsCell.make/original