import math


def StandardDeviation(delta):
  """Calculates standard deviation for a given page deltas.

  Args:
    delta: Page Delta Entities(Must contain 1 or more values in delta).

  Returns:
    Standard Deviation Value.
  """
  if len(delta) == 1:
    return 0
  mean = 0
  for e in delta:
    if not e.score or e.score < 0:
      return None
    mean += e.score
  mean /= float(len(delta))
  deviation = 0
  for e in delta:
    deviation += (e.score-mean)**2
  deviation = math.sqrt(deviation/float(len(delta)-1))
  return deviation