def METHOD_NAME(vm, device_id):
    """
    check whether specified block device tray is open or not.
    Return True, if device is opened, else False.
    : param vm: VM object
    : device_id: block device identifier
    """
    blocks_info = vm.monitor.info('block')
    if vm.check_capability(Flags.BLOCKDEV):
        device_id = vm.devices.get_qdev_by_drive(device_id)
    if isinstance(blocks_info, str):
        open_str = 'tray open'
        close_str = 'tray closed'
        for block in blocks_info.splitlines():
            if device_id in block:
                if open_str in block:
                    return True
                elif close_str in block:
                    return False
    else:
        for block in blocks_info:
            if device_id in str(block) and block.get('tray_open'):
                return block['tray_open']
    return False