code: def import_categories(self, category_nodes):
          
          self.write_out(self.style.STEP('- Importing categories\n'))
  
          categories = {}
          for category_node in category_nodes:
              title = category_node.find('{%s}cat_name' % WP_NS).text[:255]
              slug = category_node.find(
                  '{%s}category_nicename' % WP_NS).text[:255]
              try:
                  parent = category_node.find(
                      '{%s}category_parent' % WP_NS).text[:255]
              except TypeError:
                  parent = None
              self.write_out('> %s... ' % title)
              category, created = Category.objects.get_or_create(
                  slug=slug, defaults={'title': title,
                                       'parent': categories.get(parent)})
              categories[title] = category
              self.write_out(self.style.ITEM('OK\n'))
          return categories
docs: Import all the categories from 'wp:category' nodes,
          because categories in 'item' nodes are not necessarily
          all the categories and returning it in a dict for
          database optimizations.