Consider the Eisenstein series given by $$ G_{k}(\chi,z) = \sum_{m,n\in \mathbb{Z}, (n,N) = 1}\frac{\chi(n)}{(mz + n)^{k}} $$ where $\chi:(\mathbb{Z}/N\mathbb{Z})^{\times}\rightarrow \mathbb{C}^{\times}$ is a Dirichlet character with $\chi(-1) = (-1)^{k},k\geq 3$.
It is clear $G_{k}(\chi,z + N) = G_{k}(\chi,z)$, and we can have a $q$-expansion in the form $$ G_{k}(\chi,z) = \sum_{n\geq 0}c_{n}e^{2\pi in z/N} $$ where $c_{0} = 2L(\chi,k)$, and $$ c_{n} = 2\frac{(-2\pi i)^{k}}{(k-1)!N^{k}}\left(\sum_{1\leq a \leq N,(a,N) = 1}\chi(a)e^{2\pi ia/N}\right)\sum_{d|n}\chi(d)^{-1}d^{k-1}. $$ My question is: how can we deduce this form of coefficient by adapting the method for obtaining the $q$-expansion of usual Eisenstein series, i.e. using $$ \pi \cot(\pi z) = \frac{1}{z} + \sum_{n\geq 0}\left(\frac{1}{z + n} + \frac{1}{z-n}\right). $$ In particular, I am not sure how to incorporate the Dirichlet character into this formula. Any help for deducing this $q$-expansion or providing related reference will be helpful.