Sign in a signed out entry.

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

def undo_sign_out(entry, session=None):
    """Sign in a signed out entry.

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

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

    if entry_to_sign_in:
        logger.info('Undo sign out: {}'.format(entry_to_sign_in.user_id))
        logger.debug('Undo sign out: {}'.format(entry_to_sign_in))
        entry_to_sign_in.time_out = None
        session.add(entry_to_sign_in)
        session.commit()
    else:
        error_message = 'Entry not found: {}'.format(entry)
        logger.error(error_message)
        raise ValueError(error_message)