<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create(cls, name, datacenter, subnet=None, gateway=None, background=False):
 """Create a new vlan."""

        if not background and not cls.intty():
            background = True

        datacenter_id_ = int(Datacenter.usable_id(datacenter))

        vlan_params = {
            'name': name,
            'datacenter_id': datacenter_id_,
        }

        if subnet:
            vlan_params['subnet'] = subnet
        if gateway:
            vlan_params['gateway'] = gateway

        result = cls.call('hosting.vlan.create', vlan_params)

        if not background:
            # interactive mode, run a progress bar
            cls.echo('Creating your vlan.')
            cls.display_progress(result)
            cls.echo('Your vlan %s has been created.' % name)

        return result