def from_function(cls, f, *args, **kwargs):
        """
        Create a new instance from a function. Gets the code object from
        the function and passes it and any other specified parameters to
        :meth:`from_code`.

        Arguments:
            f(function): The function to get the code object from.

        Returns:
            CodeObject: A new :class:`CodeObject` instance.
        """

        return cls.from_code(six.get_function_code(f), *args, **kwargs)