This should be put in a trait later.
481913
public function extractEmailFromReceiver($receiver)
    {
        if (is_object($receiver) && method_exists($receiver, "getEmail"))
            return $receiver->getEmail();
        if (is_string($receiver))
            return $receiver;
        // But what to do now? :=)
        return null;
    }
675460
def on_finish(self, func):
        '''
        '''
        if self._done.is_set():
            if self._failure is None:
                backend.schedule(func, args=(self._value,))
        else:
            self._cbacks.append(func)
340855
public function traits($name)
    {
        if (is_array($name)) {
            $this->traits = array_merge($this->traits, $name);
        } else {
            $this->traits[] = $name;
        }
    }
189369
def event_later(self, delay, data_tuple):
        
        return self._base.event_later(delay, self.make_event_data(*data_tuple))
30570
def add_characteristic(options)
      self.characteristics ||= []
      characteristic = CharacteristicAssertion.new
      characteristic.add_value(options)
      self.characteristics << characteristic
    end
1144845
function done( error ) {
				if ( error ) {
					next( error );
					return;
				}
				if ( !request.hasOwnProperty( 'locals' ) ) {
					request.locals = {};
				}
				request.locals.monitor = metrics;
				next();
			}
1285086
public function onBeforeWrite()
    {
        parent::onBeforeWrite();

        if (empty($this->Secret)) {
            $this->Secret = $this->generateSecret();
        }

        if (empty($this->Identifier)) {
            $this->Identifier = $this->generateSecret();
        }
    }
402714
def add_final_state(self, f):

        
        if f not in self.Q:
            LOG.error("The specified value is invalid, f must be a member of Q")
            raise InputError("The specified value is invalid, f must be a member of Q")

        self.F.add(f)
1034412
def immediate(self, name, value):
        
        setattr(self, name, value)
        self._all.add(name)
332576
void maybePrepareCall(Reference ref) {
    CallSiteType callSiteType = classifyCallSite(ref);
    callSiteType.prepare(this, ref);
  }
312328
def later(timeout, f, *args, **kwargs):
    '''
    
    '''
    def wrap(*args, **kwargs):
        sleep(timeout)
        return f(*args, **kwargs)

    return spawn(wrap, *args, **kwargs)
987520
public void addLast( AbstractJournalOperation op )
    {
        if (tail == null)
        {
            head = tail = op;
        }
        else
        {
            tail.setNext(op);
            tail = op;
        }
        
        op.setNext(null);
        size++;
    }
851006
def _on_outcome(self, outcome, condition):
        
        self._outcome = outcome
        self._condition = condition
317269
public void setTraits(java.util.Collection<Trait> traits) {
        if (traits == null) {
            this.traits = null;
            return;
        }

        this.traits = new java.util.ArrayList<Trait>(traits);
    }
973057
@Override
    @GraphTransaction
    public void addTrait(List<String> entityGuids, ITypedStruct traitInstance) throws RepositoryException {
        Preconditions.checkNotNull(entityGuids, "entityGuids list cannot be null");
        Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null");

        if (LOG.isDebugEnabled()) {
            LOG.debug("Adding a new trait={} for entities={}", traitInstance.getTypeName(), entityGuids);
        }

        GraphTransactionInterceptor.lockObjectAndReleasePostCommit(entityGuids);
        for (String entityGuid : entityGuids) {
            addTraitImpl(entityGuid, traitInstance);
        }
    }
227862
public static void insertAfter(Element newElement, Element after) {
        after.parentNode.insertBefore(newElement, after.nextSibling);
    }
289703
private void addLastOfType() {
		for (Node node : nodes) {
			Index index = helper.getIndexInParent(node, true);
			if (index.index == (index.size-1))
				result.add(node);
		}
	}