from abc import ABCMeta, abstractmethod

class mySequence(object):
    """mySequence"""
    __metaclass__ = ABCMeta # Python 2 style

    @abstractmethod
    def __len__(self):
        """Return the length of the sequence"""

    @abstractmethod
    def __getitem__(self, j):
        """Return the jth element of the sequence"""
        
    def __contains__(self, item):
        """For the use if key word 'in'

        For example:
        if item1 in seq:....
        Could use advanced search algorithm here..
        """
        for i in range(len(self)):
            if self[i] == item:
                return True

        return False

    def __eq__(self, other):
        """Compare element one by one, return True if they are all the same"""
        if len(self) != len(other):
            

        
        for j in range(len(self)):
            if self[j] != other[j]:
                return False

        return True

    def index(self, val):
        """Return leftmost index at which val is found, or raise Error"""
        for j in range(len(self)):
            if self[j] == val:
                return j

        raise ValueError('element not found.')

    def count(self, val):
        """Return the number of element val"""
        cnt = 0  # keep result number
        for j in range(len(self)):
            if self[j] == val:
                cnt += 1

        return cnt
    

if __name__ == '__main__':

    print 'test.'

return False