@classmethod
def create(cls, obj=None, attrs=None, id=None, **kwargs):
    """ creates an instance of class, given an object and the
        attributes to take from it. (if attrs is None, tries to get
        cls.attrs next. If an attribute is not on object,
        stores None instead.
        kwargs are passed through, but are overwritten by attributes
        on object if in `attrs`.

        If obj is None, just creates with kwargs.
        Note that id is a primary key, so be careful with passing it!"""
    attrs = attrs or cls.attrs
    if object:
        for k in attrs:
            v = getattr(obj, k, None)
            if v is not None:
                kwargs[k] = v
    return cls(id=id, **kwargs)
