title: Unable to construct python class
body: <p>I have the following functions, that are working within the boundaries on the Python script</p>
  
  <p>The <code>loop_vcenters</code> function will return a dictinary with <code>cluster: host
  subs_per_socket</code>  function will return the number of sockets for esx</p>
  
  <pre><code>def loop_vcenters(vcenters):
      #------------------------- connect to vcenter ----------------------------------------
      si = SmartConnect(host = vcenters,user = 'username',pwd = 'password' ,sslContext=context)
      # disconnect from vcenter one done
      atexit.register(Disconnect, si)
      #get the object content from vcenter
      content = si.RetrieveContent()
      #list clusters
      cluster_host_dic_list=[]
      cluster_name = ""
      for cluster_obj in get_obj(content, vim.ComputeResource):
          cluster=cluster_obj.name
          hosts=[]
          for host in cluster_obj.host:
              hosts.append(host.name)
          #create dictinary ,key=cluster value=esx
          cluster_dic={cluster:hosts}
          cluster_host_dic_list.append(cluster_dic)
      return cluster_host_dic_list
  
  def subs_per_socket(host):
      shost = content.searchIndex.FindByDnsName(dnsName=host, vmSearch=False)
      socket_count = shost.summary.hardware.numCpuPkgs
      sub_per_socket = socket_count/2
      return sub_per_socket
  </code></pre>
  
  <p>I want to put both functions into a class, but I cannot figure out how</p>
  
  <pre><code>class loop_vcenters:    
      def hosts_dic(self,name):
          si = SmartConnect(host = vcenters,user = 'username',pwd = 'password' ,sslContext=context)
          atexit.register(Disconnect, si)
          content = si.RetrieveContent()
          cluster_host_dic_list=[]
          cluster_name = ""
          for cluster_obj in get_obj(content, vim.ComputeResource):
              cluster=cluster_obj.name
              hosts=[]
              for host in cluster_obj.host:
                  hosts.append(host.name)
              cluster_dic={cluster:hosts}
              cluster_host_dic_list.append(cluster_dic)
        return cluster_host_dic_list
  </code></pre>
  
  <ol>
  <li>I am unable to get the host dictionary like the <code>loop_vcenters</code> function returned.</li>
  </ol>
  
  <pre><code>d = loop_vcenters('vcenters')
  Traceback (most recent call last):
  File "", line 1, in 
    File "", line 5, in __init__
  NameError: global name 'vcenters' is not defined
  </code></pre>
  
  <ol start="2">
  <li>How can I add the <code>subs_per_socket(host)</code> function to the class?</li>
  </ol>