title: Check if a function uses @classmethod
body: <p><strong>TL;DR</strong> How do I find out whether a function was defined using <code>@classmethod</code> or something with the same effect?</p>
  
  <hr>
  
  <p><strong>My problem</strong></p>
  
  <p>For implementing a class decorator I would like to check if a method takes the class as its first argument, for example as achieved via</p>
  
  <pre><code>@classmethod
  def function(cls, ...):
  </code></pre>
  
  <p>I found a solution to check for <code>@staticmethod</code> via the <code>types</code> module (<code>isinstance(foo, types.UnboundMethodType)</code> is <code>False</code> if the <code>foo</code> is static, see <a href="https://stackoverflow.com/a/695694">here</a>), but did not find anything on how to do so for <code>@classmethod</code></p>
  
  <hr>
  
  <p><strong>Context</strong></p>
  
  <p>What I am trying to do is something along the lines of</p>
  
  <pre><code>def class_decorator(cls):
      for member in cls.__dict__:
          if (isclassmethod(getattr(cls, member))):
              # do something with the method
              setattr(cls, member, modified_method)
      return cls
  </code></pre>
  
  <p>and I do not know how to implement what I called <code>isclassmethod</code> in this example</p>