title: filtering lists based on multiple conditions
body: <p>I'm learning Python based on the list below I'd like to filter based on several different conditions and combine the results. </p>
  
  <pre><code>list_of_stuff = [
      "aus-airport-1",
      "aus-airport-2",
      "us-airport-1",
      "us-airport-2",
      "aus-ship-1",
      "us-ship-99",
      "nz-airport-1"
  ]
  </code></pre>
  
  <p>The program should be able to allow a user to:</p>
  
  <ul>
  <li>print all regions excluding nz</li>
  <li>print all regions in aus</li>
  <li>print all ships</li>
  </ul>
  
  <p>A mock of my idea is below, I'm sure there must be a better pattern like map,filter,reduce or even the built in filter so looking for help on how to improve. The program will accept and users input and only filter if a filter type is specified. For example list_of_stuff --exclude_region nz --transport ship. </p>
  
  <p>My mock attempt </p>
  
  <pre><code>def filter_transport(stuff,transport):
      if transport:
          if stuff.split("-")[1] == transport:
              return True
          else:
              return False
      else:
          return True    
  
  def exclude_region(stuff,region):
      if region:
          if stuff.split("-")[0] ==region:
              return True
      else:
          return False    
  
  def included_region(stuff,region):
      if region:
          if stuff.split("-")[0] ==region:
              return True
          else:
              return False
      else:
          return True    
  
  def filters(stuff,transport=None,include_region=None,excluded_region=None):
      if( filter_transport(stuff,transport) and 
          included_region(stuff,include_region) and not exclude_region(stuff,excluded_region)  ):
          return True    
  
  
  #give all airports excluding nz
  stuff = [stuff for stuff in list_of_stuff if filters(stuff,transport="airport",excluded_region="nz")]
  print (stuff)
  #give all airports in aus
  stuff = [stuff for stuff in list_of_stuff if filters(stuff,transport="airport",include_region="aus")]
  print (stuff)
  #give all ships
  stuff = [stuff for stuff in list_of_stuff if filters(stuff,transport="ship")]
  print (stuff)
  </code></pre>