title: Python SyntaxError: invalid syntax for "elif len(org) >= 1:"
body: <p>When importing the following function to the Ipython 1.1 interpreter a SyntaxError is raised telling me that "elif len(org) >= 1:" is invalid syntax. My immediate thought is that my spacing should be incorrect but that does not appear to be the case.</p>
  
  <p>If we walk through this function from the initial for loop on line 3, the error is raised on the third set of if/elif statements. </p>
  
  <p>Given that this is a rather unpythonic function it may be best to break this up into several smaller functions. That should resolve the SyntaxError.</p>
  
  <p>Would you agree that breaking this function into smaller functions is the best way to resolve this error? Do you know why the error was raised when the spacing and syntax appears, at least to me, to be correct?</p>
  
  <p>Thank you for your time!</p>
  
  <pre><code>def get_it(test_this):
      find_full_word = []
      for token in st.tag(test_this.split()):
          name = []
          org = []
          loc = []
          if len(token) == 2:
              x,y = token
              if y == 'PERSON':  
                  name.append(x)
              elif y == 'ORGANIZATION':
                  org.append(x)
              elif y == 'LOCATION':
                  loc.append(x)
              elif y == 'O':
                  if len(name) &gt;= 1:
                      n_term = ""
                      for n_item in name:
                          if len(n_term) &gt; 0:
                              n_term = n_term + " " + n_item
                          else:
                              n_term = n_item
                      while len(name) &gt; 0:
                          name.pop()
                      find_full_word.append((n_term, "PERSON")
                ### error is raised here ####
                  elif len(org) &gt;= 1:
                # # # # # # # # # # # # # # #
                      o_term = ""
                      for o_item in org:
                          if len(o_term) &gt; 0:
                              o_term = o_term + " " + o_item
                          else:
                              o_term = o_item
                      while len(org) &gt; 0:
                          org.pop()
                      find_full_word.append(o_term,"ORGANIZATION")
                  elif len(loc) &gt;= 1:
                      l_term = ""
                      for l_item in loc:
                          if len(l_term) &gt; 0:
                              l_term = l_term + " " + l_item
                          else:
                              l_term = l_item
                      while len(loc) &gt; 0:
                          loc.pop()
                      find_full_word.append(l_term, "LOCATION")
          if len(name) == 1:
              find_full_word.append(name)
          elif len(org) == 1:
              find_full_word.append(org)
          elif len(loc) == 1:
              find_full_word.append(loc)
          else:
              raise UserWarning("No PERSON, ORGANIZATION, LOCATION was found")
      return find_full_word
  </code></pre>