def get_message_id(message):
    """Similar to :meth:`get_input_peer`, but for message IDs."""
    if message is None:
        return None
    if isinstance(message, int):
        return message
    try:
        if message.SUBCLASS_OF_ID == 2030045667:
            return message.id
    except AttributeError:
        pass
    raise TypeError('Invalid message type: {}'.format(type(message)))
