title: How to abstract away command code in custom django commands
body: <p>I'm writing custom django commands under my apps <code>management/commands</code> directory. At the moment I have 6 different files in that directory. Each file has a different command that solves a unique need. However, there are some utilities that are common to all of them. What is the best way to abstract away this common code? </p>
  
  <p>Below is an example:</p>
  
  <p><em><code>load_colors</code></em></p>
  
  <pre><code>class Command(BaseCommand):
     def handle(self, *args, **options)
        ....code unique to colors
     def check_validity(self, color)
        ....#code common to both shades and colors
  </code></pre>
  
  <p><em><code>load_shades</code></em></p>
  
  <pre><code> class Command(BaseCommand):
     def handle(self, *args, **options)
        ....#code unique to shades
     def check_validity(self, color)
        ....#code common to both shades and colors
  </code></pre>