'Performs set up for executing the spatial function.'

def _spatial_setup(self, att, desc=None, field_name=None, geo_field_type=None):

    connection = connections[self.db]
    func = getattr(connection.ops, att, False)
    if (desc is None):
        desc = att
    if (not func):
        raise NotImplementedError(('%s    stored    procedure    not    available    on    the    %s    backend.' % (desc, connection.ops.name)))
    procedure_args = {'function': func}
    geo_field = self.query._geo_field(field_name)
    if (not geo_field):
        raise TypeError(('%s    output    only    available    on    GeometryFields.' % func))
    if ((not (geo_field_type is None)) and (not isinstance(geo_field, geo_field_type))):
        raise TypeError(('"%s"    stored    procedures    may    only    be    called    on    %ss.' % (func, geo_field_type.__name__)))
    procedure_args['geo_col'] = self._geocol_select(geo_field, field_name)
    return (procedure_args, geo_field)
