title: Python code to list dependencies, avoiding loops
body: <p>Say you have a dictionary describing item dependencies, along the lines of: </p>
  
  <pre><code>deps = {
      'A': ['B', 'C', 'D'],
      'B': ['C', 'E'],
      'C': ['D', 'F'],
      'D': ['C', 'G'],
      'E': ['A'],
      'H': ['N'],
  }
  </code></pre>
  
  <p>meaning that item 'A' depends on items 'B', 'C', and 'D', etc. Obviously, this could be of arbitrary complexity. </p>
  
  <p>How do you write a function <code>get_all_deps(item)</code> that gives you a list of all the dependencies of <code>item</code>, without duplicates and without <code>item</code>. E.g.: </p>
  
  <pre><code>&gt; get_all_deps('H')
  ['N']
  &gt; get_all_deps('A')
  ['B', 'C', 'D', 'E', 'F', 'G']
  &gt; get_all_deps('E')
  ['A', 'B', 'C', 'D', 'F', 'G']
  </code></pre>
  
  <p>I'm looking for concise code - ideally a single recursive function. Performance is not terribly important for my use case - we're talking about fairly small dependency graphs (e.g. a few dozen items)</p>