<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_flowspec_global_table(self, flowspec_family, rules, actions=None, is_withdraw=False):
 """Update a BGP route in the Global table for Flow Specification. ``flowspec_family`` specifies one of the Flow Specification family name. ``rules`` specifies NLRIs of Flow Specification as a dictionary type value. `` actions`` specifies Traffic Filtering Actions of Flow Specification as a dictionary type value. If `is_withdraw` is False, which is the default, add a BGP route to the Global table. If `is_withdraw` is True, remove a BGP route from the Global table. """


        from ryu.services.protocols.bgp.core import BgpCoreError
        from ryu.services.protocols.bgp.api.prefix import (
            FLOWSPEC_FAMILY_IPV4,
            FLOWSPEC_FAMILY_IPV6,
            FLOWSPEC_FAMILY_L2VPN,
        )

        src_ver_num = 1
        peer = None

        # set mandatory path attributes
        origin = BGPPathAttributeOrigin(BGP_ATTR_ORIGIN_IGP)
        aspath = BGPPathAttributeAsPath([[]])

        pathattrs = OrderedDict()
        pathattrs[BGP_ATTR_TYPE_ORIGIN] = origin
        pathattrs[BGP_ATTR_TYPE_AS_PATH] = aspath

        if flowspec_family == FLOWSPEC_FAMILY_IPV4:
            _nlri = FlowSpecIPv4NLRI.from_user(**rules)
            p = IPv4FlowSpecPath

            try:
                communities = create_v4flowspec_actions(actions)
            except ValueError as e:
                raise BgpCoreError(desc=str(e))

            if communities:
                pathattrs[BGP_ATTR_TYPE_EXTENDED_COMMUNITIES] = (
                    BGPPathAttributeExtendedCommunities(
                        communities=communities))
        elif flowspec_family == FLOWSPEC_FAMILY_IPV6:
            _nlri = FlowSpecIPv6NLRI.from_user(**rules)
            p = IPv6FlowSpecPath

            try:
                communities = create_v6flowspec_actions(actions)
            except ValueError as e:
                raise BgpCoreError(desc=str(e))

            if communities:
                pathattrs[BGP_ATTR_TYPE_EXTENDED_COMMUNITIES] = (
                    BGPPathAttributeExtendedCommunities(
                        communities=communities))
        elif flowspec_family == FLOWSPEC_FAMILY_L2VPN:
            _nlri = FlowSpecL2VPNNLRI.from_user(**rules)
            p = L2vpnFlowSpecPath

            try:
                communities = create_l2vpnflowspec_actions(actions)
            except ValueError as e:
                raise BgpCoreError(desc=str(e))

            if communities:
                pathattrs[BGP_ATTR_TYPE_EXTENDED_COMMUNITIES] = (
                    BGPPathAttributeExtendedCommunities(
                        communities=communities))
        else:
            raise BgpCoreError(
                desc='Unsupported flowspec family %s' % flowspec_family)

        new_path = p(peer, _nlri, src_ver_num,
                     pattrs=pathattrs, is_withdraw=is_withdraw)

        # add to global table and propagates to neighbors
        self.learn_path(new_path)