title: Creating my own filter function in python
body: <p>I need to create my own filter function in python, i.e., it should return the value from an iterable only if running any given function on it returns <code>True</code> or, if the function is <code>None</code>, if the iterable itself returns <code>True</code>. My problem is that I cannot get to work with a function that returns only even numbers.</p>
  
  <p>This is my code: </p>
  
  <pre><code>def my_own_filter(func, *iterable):
      l = []
      if func is None:
          for i in iterable:
              if i:
                  l.append(i)
      else:
          for i in iterable:
              if func(i):
                  l.append(i)
      return(l)
  
  
  print(my_own_filter(None, 1, 0, -1, (), "hello", 1, 2, 3, 4))
  print(my_own_filter(sum, (1, 2, 3), [], [3, 4, 5]))
  </code></pre>
  
  <p>Any help will be highly appreciated!</p>