def GenerateEnv(context):
  """Generates environmental variables for a pod.

  Args:
    context: Template context, which can contain the following properties:
             env - Environment variables to set.

  Returns:
    A list containing env variables in dict format {name: 'name', value: 'value'}
  """
  env = []
  tmp_env = context.properties.get('env', [])
  for entry in tmp_env:
    if isinstance(entry, dict):
      env.append({'name': entry.get('name'), 'value': entry.get('value')})
  return env