title: Private helper functions in Python classes are giving "global name <name of method> is not defined"
body: <p>I am creating a class which holds a dict, and has some methods to extract information based on the data in the dict. Each key points to a list of strings. Each string in the list is of the form <code>name(data).</code></p>
  
  <p>I am very new to programming in Python and have mainly used Java previously. I have created a couple of private helper functions that are to be used for in my public methods. Here is an example to illustrate what I'm trying to do: </p>
  
  <pre><code>def _getItemName(item):
      str = ""
      for c in item:
          if c!= '(':
              str += c
          else:
              break
      return str
  </code></pre>
  
  <p>This method is then used in several public methods, like in this example:</p>
  
  <pre><code>def getCertainItemsByName(self, key, name):
      foundItems = []
      for item in self.itemMap[key]:
          if _getItemName(item) == name:
              foundItems.append(item)
      return foundItems
  </code></pre>
  
  <p>This is giving me an error equivalent to "global name "_getItemName" is not defined. I realize I could just declare the method outside of the class, but the method is class-specific so that's not something I want to do. What is the best to do this?</p>