@classmethod
def _from_object(cls, profile):
    """Construct a profile from profile object.

        :param profile: a profile object that contains all required fields.
        """
    kwargs = {'id': profile.id, 'type': profile.type, 'context': profile.
        context, 'user': profile.user, 'project': profile.project, 'domain':
        profile.domain, 'metadata': profile.metadata, 'created_at': profile
        .created_at, 'updated_at': profile.updated_at}
    return cls(profile.name, profile.spec, **kwargs)
