def cookbook_statement(cookbook_name, metadata=None):
        """Return a valid Ruby 'cookbook' statement for the Berksfile."""
        line = "cookbook '%s'" % cookbook_name
        if metadata:
            if not isinstance(metadata, dict):
                raise TypeError("Berksfile dependency hash for %s "
                                "should be a dict of options, not %s."
                                % (cookbook_name, metadata))
            # not like the others...
            if 'constraint' in metadata:
                line += ", '%s'" % metadata.pop('constraint')
            for opt, spec in metadata.items():
                line += ", %s: '%s'" % (opt, spec)
        return line
Return a valid Ruby 'cookbook' statement for the Berksfile.