<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def _sem_crawl(self, sem, res):
 """ use semaphore ``encapsulate`` the crawl_media \n with async crawl, should avoid crawl too fast to become DDos attack to the crawled server should set the ``semaphore size``, and take ``a little gap`` between each crawl behavior. :param sem: the size of semaphore :type sem: :param res: :type res: dict :return: :rtype: """

        async with sem:
            st_ = await self.crawl_raw(res)
            if st_:
                self.result['ok'] += 1
            else:
                self.result['fail'] += 1

            # take a little gap
            await asyncio.sleep(random.randint(0, 1))