code: def create(
              self, policy_id, name, threshold_type, query, since_value, terms,
              expected_groups=None, value_function=None, runbook_url=None,
              ignore_overlap=None, enabled=True):
          data = {
              'nrql_condition': {
                  'type': threshold_type,
                  'name': name,
                  'enabled': enabled,
                  'terms': terms,
                  'nrql': {
                      'query': query,
                      'since_value': since_value
                  }
              }
          }
          if runbook_url is not None:
              data['nrql_condition']['runbook_url'] = runbook_url
          if expected_groups is not None:
              data['nrql_condition']['expected_groups'] = expected_groups
          if ignore_overlap is not None:
              data['nrql_condition']['ignore_overlap'] = ignore_overlap
          if value_function is not None:
              data['nrql_condition']['value_function'] = value_function
          if data['nrql_condition']['type'] == 'static':
              if 'value_function' not in data['nrql_condition']:
                  raise ConfigurationException(
                      'Alert is set as static but no value_function config specified'
                  )
              data['nrql_condition'].pop('expected_groups', None)
              data['nrql_condition'].pop('ignore_overlap', None)
          elif data['nrql_condition']['type'] == 'outlier':
              if 'expected_groups' not in data['nrql_condition']:
                  raise ConfigurationException(
                      'Alert is set as outlier but expected_groups config is not specified'
                  )
              if 'ignore_overlap' not in data['nrql_condition']:
                  raise ConfigurationException(
                      'Alert is set as outlier but ignore_overlap config is not  specified'
                  )
              data['nrql_condition'].pop('value_function', None)
          return self._post(
              url='{0}alerts_nrql_conditions/policies/{1}.json'.format(self.URL, policy_id),
              headers=self.headers,
              data=data
          )