<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Bonus1
Step1:  Bonus2
Step3:  Unit Tests
<ASSISTANT_TASK:>
Python Code:
def lstrip(iterable, obj):
    stop = False    
    for item in iterable:
        if stop:
            yield item
        elif item != obj:
            yield item
            stop = True          
   
x = lstrip([0, 1, 2, 3, 0], 0)
x
list(x)
Explanation: Bonus1: return an iterator (for example a generator) from your lstrip function instead of a list.
End of explanation
def lstrip(iterable, obj):
    lstrip_stop = False    
    for item in iterable:
        if lstrip_stop:
            yield item
        else: 
            if not callable(obj):
                if item != obj:
                    yield item
                    lstrip_stop = True
            else:
                if not obj(item):
                    yield item
                    lstrip_stop = True
                    
def is_falsey(value): return not bool(value)
list(lstrip(['', 0, 1, 0, 2, 'h', ''], is_falsey))
list(lstrip([-4, -2, 2, 4, -6], lambda n: n < 0))
numbers = [0, 2, 4, 1, 3, 5, 6]
def is_even(n): return n % 2 == 0
list(lstrip(numbers, is_even))
list(lstrip([0, 0, 1, 0, 2, 3], 0))
list(lstrip('  hello ', ' '))
Explanation: Bonus2: allow your lstrip function to accept a function as its second argument which will determine whether the item should be stripped
End of explanation
import unittest
class LStripTests(unittest.TestCase):
    Tests for lstrip.
    def assertIterableEqual(self, iterable1, iterable2):
        self.assertEqual(list(iterable1), list(iterable2))
    def test_list(self):
        self.assertIterableEqual(lstrip([1, 1, 2, 3], 1), [2, 3])
    def test_nothing_to_strip(self):
        self.assertIterableEqual(lstrip([1, 2, 3], 0), [1, 2, 3])
    def test_string(self):
        self.assertIterableEqual(lstrip('  hello', ' '), 'hello')
    def test_empty_iterable(self):
        self.assertIterableEqual(lstrip([], 1), [])
    def test_strip_all(self):
        self.assertIterableEqual(lstrip([1, 1, 1], 1), [])
    def test_none_values(self):
        self.assertIterableEqual(lstrip([None, 1, 2, 3], 0), [None, 1, 2, 3])
    def test_iterator(self):
        squares = (n**2 for n in [0, 0, 1, 2, 3])
        self.assertIterableEqual(lstrip(squares, 0), [1, 4, 9])
    # To test the Bonus part of this exercise, comment out the following line
    # @unittest.expectedFailure
    def test_returns_iterator(self):
        stripped = lstrip((1, 2, 3), 1)
        self.assertEqual(iter(stripped), iter(stripped))
    # To test the Bonus part of this exercise, comment out the following line
    # @unittest.expectedFailure
    def test_function_given(self):
        numbers = [0, 2, 4, 1, 3, 5, 6]
        def is_even(n): return n % 2 == 0
        self.assertIterableEqual(lstrip(numbers, is_even), [1, 3, 5, 6])
if __name__ == "__main__":
    unittest.main(argv=['ignore-first-arg'], exit=False)
Explanation: Unit Tests
End of explanation
<END_TASK>