def copy(value, **kwargs):
    """Return a copy of a **HasProperties** instance

    A copy is produced by serializing the HasProperties instance then
    deserializing it to a new instance. Therefore, if any properties
    cannot be serialized/deserialized, :code:`copy` will fail. Any
    keyword arguments will be passed through to both :code:`serialize`
    and :code:`deserialize`.
    """

    if not isinstance(value, HasProperties):
        raise ValueError('properties.copy may only be used to copy'
                         'HasProperties instances')
    kwargs.update({'include_class': kwargs.get('include_class', True)})
    kwargs.update({'trusted': kwargs.get('trusted', True)})
    return value.__class__.deserialize(value.serialize(**kwargs), **kwargs)