'Create a deployment.
:param str ref: (required), The ref to deploy. This can be a branch,
tag, or sha.
:param list required_contexts: Optional array of status contexts
verified against commit status checks. To bypass checking
entirely pass an empty array. Default: []
:param str payload: Optional JSON payload with extra information about
the deployment. Default: ""
:param bool auto_merge: Optional parameter to merge the default branch
into the requested deployment branch if necessary. Default: False
:param str description: Optional short description. Default: ""
:param str environment: Optional name for the target deployment
environment (e.g., production, staging, qa). Default: "production"
:returns: :class:`Deployment <github3.repos.deployment.Deployment>`'

@requires_auth
def create_deployment(self, ref, required_contexts=None, payload=u'', auto_merge=False, description=u'', environment=None):

    json = None
    if ref:
        if (required_contexts is None):
            required_contexts = []
        url = self._build_url(u'deployments', base_url=self._api)
        data = {u'ref': ref, u'required_contexts': required_contexts, u'payload': payload, u'auto_merge': auto_merge, u'description': description, u'environment': environment}
        self._remove_none(data)
        json = self._json(self._post(url, data=data), 201)
    return self._instance_or_null(Deployment, json)
