def determine_file_type(self, name):
        """
        >>> str(MediaFile().determine_file_type('foobar.jpg'))
        'image'
        >>> str(MediaFile().determine_file_type('foobar.PDF'))
        'pdf'
        >>> str(MediaFile().determine_file_type('foobar.jpg.pdf'))
        'pdf'
        >>> str(MediaFile().determine_file_type('foobar.jgp'))
        'other'
        >>> str(MediaFile().determine_file_type('foobar-jpg'))
        'other'
        """
        for type_key, type_name, type_test in self.filetypes:
            if type_test(name):
                return type_key
        return self.filetypes[-1][0]

        >>> str(MediaFile().determine_file_type('foobar.jpg'))
        'image'
        >>> str(MediaFile().determine_file_type('foobar.PDF'))
        'pdf'
        >>> str(MediaFile().determine_file_type('foobar.jpg.pdf'))
        'pdf'
        >>> str(MediaFile().determine_file_type('foobar.jgp'))
        'other'
        >>> str(MediaFile().determine_file_type('foobar-jpg'))
        'other'
        
feincms/module/medialibrary/models.py