@classmethod
def from_file(cls, file_obj):
    """ Create a packet instance from bytes read from a file-like object.
        This class method is only meant to be called on subclasses that
        define _bytes and _type class properties.
        Note: file_obj position will be changed after calling this function.

        Keyword arguments:
        file_obj -- file-like object to read bytes from

        Return new packet instance.
        """
    instance = cls()
    for name, data_type in cls._bytes:
        val = data_type.get(file_obj, instance)
        setattr(instance, name, val)
    return instance
