Function to get a key for a source