def undo_sign_in(entry, session=None):
    """Delete a signed in entry.

    :param entry: `models.Entry` object. The entry to delete.
    :param session: (optional) SQLAlchemy session through which to access the database.
    """ # noqa
    if session is None:
        session = Session()
    else:
        session = session

    entry_to_delete = (
        session
        .query(Entry)
        .filter(Entry.uuid == entry.uuid)
        .one_or_none()
    )

    if entry_to_delete:
        logger.info('Undo sign in: {}'.format(entry_to_delete.user_id))
        logger.debug('Undo sign in: {}'.format(entry_to_delete))
        session.delete(entry_to_delete)
        session.commit()
    else:
        error_message = 'Entry not found: {}'.format(entry)
        logger.error(error_message)
        raise ValueError(error_message)
Delete a signed in entry.

    :param entry: `models.Entry` object. The entry to delete.
    :param session: (optional) SQLAlchemy session through which to access the database.