def user_id(msg):
    """
    Use the userid from the msg as the user search criteria

    Args:
        msg (errbot.backends.base.Message): The message from the bot that triggered the LDAP lookup

    Returns:
        str: The user ID that will be used to search LDAP
    """
    if hasattr(msg.frm, "userid"):
        return msg.frm.userid

    raise ValueError("Cannot determine user ID from msg.userid")