def parse_grid_id_args(grid, grid_url):
 if (grid is not None):
  id_from_grid = grid.id
 else:
  id_from_grid = None
 args = [id_from_grid, grid_url]
 arg_names = ('grid', 'grid_url')
 supplied_arg_names = [arg_name for (arg_name, arg) in zip(arg_names, args) if (arg is not None)]
 if (not supplied_arg_names):
  raise exceptions.InputError("One of the two keyword arguments is required:\n    `grid` or `grid_url`\n\ngrid: a plotly.graph_objs.Grid object that has already\n    been uploaded to Plotly.\n\ngrid_url: the url where the grid can be accessed on\n    Plotly, e.g. 'https://plot.ly/~chris/3043'\n\n")
 elif (len(supplied_arg_names) > 1):
  raise exceptions.InputError('Only one of `grid` or `grid_url` is required. \nYou supplied both. \n')
 else:
  supplied_arg_name = supplied_arg_names.pop()
  if (supplied_arg_name == 'grid_url'):
   path = six.moves.urllib.parse.urlparse(grid_url).path
   (file_owner, file_id) = path.replace('/~', '').split('/')[0:2]
   return '{0}:{1}'.format(file_owner, file_id)
  else:
   return grid.id

def parse_grid_id_args ( grid , grid_url ) : if ( grid is not None ) : id_from_grid = grid . id else : id_from_grid = None args = [ id_from_grid , grid_url ] arg_names = ( 'grid' , 'grid_url' ) supplied_arg_names = [ arg_name for ( arg_name , arg ) in zip ( arg_names , args ) if ( arg is not None ) ] if ( not supplied_arg_names ) : raise exceptions . InputError ( "One of the two keyword arguments is required:\n    `grid` or `grid_url`\n\ngrid: a plotly.graph_objs.Grid object that has already\n    been uploaded to Plotly.\n\ngrid_url: the url where the grid can be accessed on\n    Plotly, e.g. 'https://plot.ly/~chris/3043'\n\n" ) elif ( len ( supplied_arg_names ) > 1 ) : raise exceptions . InputError ( 'Only one of `grid` or `grid_url` is required. \nYou supplied both. \n' ) else : supplied_arg_name = supplied_arg_names . pop ( ) if ( supplied_arg_name == 'grid_url' ) : path = six . moves . urllib . parse . urlparse ( grid_url ) . path ( file_owner , file_id ) = path . replace ( '/~' , '' ) . split ( '/' ) [ 0 : 2 ] return '{0}:{1}' . format ( file_owner , file_id ) else : return grid . id
return the grid_id from the non-none input argument .