@staticmethod
def get_user_identifier(user_id=None, update=None):
    """Get telegram id of user given an update.

        Result itself may be passed as either parameter (for backward
            compatibility).
        """
    identifier = user_id or update
    assert identifier is not None, 'Provide a user_id or update object to get a user identifier.'
    if isinstance(identifier, dict
        ) and 'message' in identifier and 'from' not in identifier:
        identifier = identifier['message']
    if isinstance(identifier, dict) and 'from' in identifier:
        identifier = identifier['from']['id']
    assert type(identifier
        ) is int, f'Unable to find a user identifier. Got `{identifier}`'
    return identifier
