Check allowed file extensions

def __allowed_extension(self, filename, extensions):
        """ Check allowed file extensions """
        allowed_extensions = current_app.config['UPLOADS']['EXTENSIONS']
        if extensions is not None:
            allowed_extensions = extensions
        return '.' in filename and filename.rsplit('.', 1)[1].lower() in \
            allowed_extensions