def parse_userdata(options):
 userdata = options['userdata']
 if userdata:
  try:
   if userdata.startswith('@'):
    try:
     with open(userdata[1:]) as f:
      return json.load(f)
    except IOError as e:
     usage(options, 'Invalid user data file: {}'.format(e.strerror))
   else:
    return json.loads(userdata)
  except ValueError as e:
   usage(options, 'Invalid user data: {}'.format(e.args[0]))
 return None

def parse_userdata ( options ) : userdata = options [ 'userdata' ] if userdata : try : if userdata . startswith ( '@' ) : try : with open ( userdata [ 1 : ] ) as f : return json . load ( f ) except IOError as e : usage ( options , 'Invalid user data file: {}' . format ( e . strerror ) ) else : return json . loads ( userdata ) except ValueError as e : usage ( options , 'Invalid user data: {}' . format ( e . args [ 0 ] ) ) return None
parse the userdata option and add to result .