Shape key python script

I’m making a character with shape keys. I’m makin a shape for the mouth where my char smiles. I now got two shapekeys. leftSmile and rightSmile.
I’ve then made a plane and a circle and parented the circle to the plane. The circle is at 0,0 (Look at this). The bottom line means that my char isn’t smiling but havin a normal look. when the circle is at the top in the middle both shape keys should go to 1. When at the top left the rightSmile should be at 1 and leftSmile at 0. But is this doable as one python line?
Here can u see what i mean bout the smiles. Hope you understand what i mean.

I can PHP and if it was made with PHP the script would look like this(The values are the value of the circle):

if($xValue > 1){
  $lValue = 1;
$rValue = 2 - $xValue;
if($rValue > 1){
  $rValue = 1;
$rValue = -($lValue-1); //The -() makes the value of $rValue possitiv
$upValue = $yValue / 2;
$finalValue = $upValue * $sideValue;

I thought bout making it like Bassam but i would rather like to have a 0 rotation on all axis and have to plane to be 2 * 2 blender units.

Best regards