def get_file(self, file_id, sharing_key=None):
        """
        Returns file object. File properties are id, file, filename.

        """

        if type(file_id) is not list:
            file_id = [file_id]

        if self.__user_id:
            user_where = """
                AND p.entity_id IN (
                    SELECT entity_id
                    FROM relationship
                    WHERE relationship_definition_keyname IN ('viewer', 'expander', 'editor', 'owner')
                    AND is_deleted = 0
                    AND related_entity_id = %s
                    UNION SELECT id
                    FROM entity
                    WHERE sharing IN ('domain', 'public')
                    AND is_deleted = 0
                )
            """ % self.__user_id
        elif sharing_key:
            user_where = sharing_key % 'AND p.entity_id IN (SELECT id FROM entity WHERE sharing_key = \'%s\')'
        else:
            user_where = 'AND pd.public = 1'

        sql = """
            SELECT DISTINCT
                f.id,
                f.md5,
                f.filename,
                f.s3_key,
                f.url,
                f.created
            FROM
                file AS f,
                property AS p,
                property_definition AS pd
            WHERE p.value_file = f.id
            AND pd.keyname = p.property_definition_keyname
            AND f.id IN (%(file_id)s)
            %(user_where)s
            AND p.is_deleted = 0
            """ % {'file_id': ','.join(map(str, file_id)), 'user_where': user_where}
        # logging.debug(sql)

        result = []
        for f in self.db_query(sql):
            if f.get('md5'):
                filename = os.path.join('/', 'entu', 'files', self.app_settings('database-name'), f.get('md5')[0], f.get('md5'))
                if os.path.isfile(filename):
                    with open(filename, 'r') as myfile:
                        filecontent = myfile.read()
                else:
                    filecontent = None
            else:
                filecontent = None

            result.append({
                'id': f.get('id'),
                'created': f.get('created'),
                'file': filecontent,
                'filename': f.get('filename'),
                's3key': f.get('s3_key'),
                'url': f.get('url')
            })

        return result
dataset/ETHPy150Open argoroots/Entu/app/main/db.py/Entity.get_file/swapped operands of `%`