def METHOD_NAME(self, fid, save=False):
    """
    Build Lock Model istance, and optional save it
    """
    featureLockId = hashlib.md5()
    toCrypt = str(fid) + self.layerName + \
        self.appName + self.layerDatasource
    if getattr(self, 'sessionid'):
        toCrypt += self.sessionid
    featureLockId.update(toCrypt.encode('utf-8'))
    featureLock = LockModel(
        feature_id=fid,
        layer_name=self.layerName,
        app_name=self.appName,
        layer_datasource=self.layerDatasource,
        feature_lock_id=featureLockId.hexdigest()
    )
    if getattr(self, 'user'):
        if self.user.pk:
            featureLock.user = self.user
    if getattr(self, 'sessionid'):
        featureLock.sessionid = self.sessionid
    if save:
        featureLock.save()
    return featureLock