<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _check_agent_id(agent_id):
 """Checks that the given agent_id is a valid non-empty string. :param str agent_id: agent id to check. :raise CraftAiBadRequestError: If the given agent_id is not of type string or if it is an empty string. """

    if (not isinstance(agent_id, six.string_types) or
        AGENT_ID_PATTERN.match(agent_id) is None):
      raise CraftAiBadRequestError(ERROR_ID_MESSAGE)