def __get_picture_url(self, entity_id, entity_definition_keyname):
        """
        Returns Entity picture.

        """
        sql = """
            SELECT
                f.id
            FROM
                property,
                property_definition,
                file f
            WHERE property_definition.keyname=property.property_definition_keyname
            AND f.id = property.value_file
            AND property_definition.dataproperty='photo'
            AND property.entity_id = %s
            AND property.is_deleted = 0
            LIMIT 1;
        """
        f = self.db_get(sql, entity_id)
        if f:
            return '/api2/entity-%s/picture' % entity_id
        elif entity_definition_keyname in ['audiovideo', 'book', 'methodical', 'periodical', 'textbook', 'workbook']:
            return '/photo-by-isbn?entity=%s' % entity_id
        elif entity_definition_keyname == 'person':
            return 'https://secure.gravatar.com/avatar/%s?d=wavatar&s=150' % (hashlib.md5(str(entity_id)).hexdigest())
        else:
            return 'https://secure.gravatar.com/avatar/%s?d=identicon&s=150' % (hashlib.md5(str(entity_id)).hexdigest())
dataset/ETHPy150Open argoroots/Entu/app/main/db.py/Entity.__get_picture_url/original