In The Name of Allaah, The Most Merciful, The Bestower of Mercy
Imaam Ibnul Qayyim [rahimahullaah] said:
The First Group: They are those whose company is like nourishment which one cannot do without in the morning and evening. One leaves it after fulfilling his need and returns to it when he is in need [again]. The people [intended in this similitude] are those who know Allaah, His commandments, the plots of His enemies, the diseases of the hearts and their remedies [i.e. the scholars]. They are sincere to Allaah, His Messenger and His creation, and there are comprehensive benefits in their company.
The Second Group: They are those whose company is similar to medication that is needed during illness. So, as long as you are healthy, you are not in need of intermingling with them. They are those you cannot do without in [seeking after] the beneficial things of livelihood and fulfilment of various dealings, partnerships, consultation, medication and the likes.
The Third Group: They are those whose company is similar to the different types of diseases and the differences in their severity and mildness. Amongst them is one whose company is similar to chronic illness – this one does not benefit you; neither in the religious nor worldly affairs, together with the fact that you might either incur a loss in both your religious and worldly affairs or in one of them. So, if intermingling with him is made possible, it would be like the disease that will lead to death. And amongst them is the one whose company is similar to a tooth ache whose pain becomes severe, but when it leaves you the pain abates.
The Forth Group: They are those whose company is absolute destruction and intermingling with them is similar to eating poison. How common is this similitude within the people! May Allaah not make them numerous, and they are Ahlul Bidah Wad Dalaalah [The people of innovation and misguidance]. They are those who hinder [people] from the path of the Messenger [sallal-laahu-alayhi-wasallam] and call to that which is in opposition to it. They are those who hinder [people] from the path of Allaah and seek to make it cooked; so they present innovation as Sunnah and Sunnah as innovation, and they present virtue as evil and evil as virtue. And when you established Tawheed amongst them, they say: You have degraded the Awliyaa [friends of Allaah] and the righteous people. And when you establish ittibaa [correct adherence to the path of the messenger with evidence] they say: You have invalidated [the affair] of the followed Imaams. And when you command that which Allaah and His Messenger command and forbid that which Allaah and His Messenger forbid, they say: You are from those who put people to trial.
Source: Badaa’i At-tafseer Al-Jaami Limaa Fassarahu Al-Imaam Ibnul Qayyim
Vol: 3 Page: 467-469- Abridged & slightly paraphrased